-
YEAR93
Hello,
I’ve created a one-page website and enabled the smooth scroll effect by adding the
.smooth-scroll
class. However, I’m having trouble adding this effect to my site logo so that when it’s clicked, it scrolls smoothly to the top. I attempted to add the following code to myfunctions.php
file, but it didn’t work:// CHANGE SITE LOGO LINK add_filter( 'generate_logo_href', function() { return "#"; } ); // ADD SMOOTH SCROLL CLASS TO SITE LOGO add_filter( 'generate_logo_output', function( $output, $logo_url, $html ){ $my_search='site-branding-container'; $my_new_class='smooth-scroll'; $my_replace= $my_search . ' ' . $my_new_class; $new_content = str_replace($my_search, $my_replace, $output); return $new_content; } , 10, 3 );
-
Hi there,
for a one page website then i would not bother with the smooth scroll in the theme.
Disable that and just add this CSS:html { scroll-behavior: smooth; }
-
YEAR93
That solved everything. Thank you!
-
Glad to hear that
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.