Site logo

Archived topic

Enable Smooth Scroll for all anchor links

23 replies · Started by Junior Gong on July 6, 2018

Viewing posts 16–24 of 24

Hi there,

That's strange. It goes away when smooth scroll is turned off?

If I do not use “generate_smooth_scroll_elements”, there is no problem.

Also, there is no problem when using smooth-scroll class for a tag.

Can you share the filter you're using?

Try this instead:

add_filter( 'generate_smooth_scroll_elements', function( $elements ) {
  $elements[] = 'a[href*="#"]:not(.generate-back-to-top)';
  
  return $elements;
} );

I am glad to inform you that the problem is now solved!

I appreciate your help.

Awesome! Glad I could help :)

Hi!

Has this code changed? I'd like to use it but instead of working, it adds a question mark to my URL...

Hi Annamari,

The code should still work.

Can you open a new topic and link us to the page where we can see the link?

This archived topic is closed to new replies.