Site logo

Archived topic

Enable smooth-scroll on hero button

5 replies · Started by Daniel on February 21, 2020

Viewing posts 1–6 of 6

Hello,
I’m unable to get smooth-scroll to enable on a button in my hero.
I’ve ticked the enable smooth-scroll box.
My button looks like this:

<p><a class="button smooth-scroll" href="#consult">Call to Action</a></p>

And I’ve added and enabled the recommended PHP snippet:

add_filter( 'generate_smooth_scroll_elements', function( $elements ) {
  $elements[] = 'a[href*="#"]';
  
  return $elements;
} );

And still I get no smooth-scroll effect with my button. Any suggestions?

Hi Daniel,

I don't actually see a page hero on the home page.

Can you guide me to the page where the page hero/button can be seen?

Thanks :)

Sorry Leo - I accidentally disabled the GP premium plugin for a moment and it messed everything up. The plugin is re-activated and you should be able to see the hero now.

I can see it now.

You shouldn't need that PHP snippet.

Can you try modifing this:
<a name="consult"></a>

to this:
<a id="consult"></a>

That solved the issue. Even with the snippet disabled. Thank you for your incredibly fast help!!!

Glad I could help :)

This archived topic is closed to new replies.