I have a menu which has links like the following
https://examples.com/#about-us
https://examples.com/#our-team
https://examples.com/#testimony
https://examples.com/#career
https://examples.com/#contact-us
I have a single page app and want to apply smooth scrolling there.
I googled a little and found that:
The
generate_smooth_scroll_elements
allow you to initiate smooth scroll on other element classes instead of just ones with thesmooth-scroll
class.Use the following PHP snippet to apply smooth scroll to all hash links:
add_filter( 'generate_smooth_scroll_elements', function( $elements ) { $elements[] = 'a[href*="#"]'; return $elements; } );
I want to smooth scroll to particular classes only.
How to apply particular class and smooth scroll there using gutenberg block editor.