[Resolved] Smooth scroll effect on home logo in menu

Home Forums Support [Resolved] Smooth scroll effect on home logo in menu

Home Forums Support Smooth scroll effect on home logo in menu

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #997278
    Eric

    Hello,
    I make a one page site and put a smoothscroll class on each item on my top menu. It is a sticky menu and I want to put this effect on the logo on the left corner so the visitor can jump back to the top of the page with the same smooth effect. Thanks in advance for your help

    #997548
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Give this a shot:

    add_filter( 'generate_smooth_scroll_elements', function( $elements ) {
        $elements[] = '.sticky-navigation-logo a';
      
        return $elements;
    } );
    
    add_filter( 'generate_logo_href', function() {
        return '#top';
    } );

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    I also noticed a z-index issue on the page, you might want to add this:

    .header-wrap {
        z-index: 100;
    }

    Adding CSS: https://docs.generatepress.com/article/adding-css/

    Hope this helps πŸ™‚

    #997691
    Eric

    Thanks a lot for your support Tom ! You make my day ! And yes I saw for the z-index problem ! πŸ˜‰ Generate press and toolset a great combo for sure !

    #997733
    Eric

    I add your code in my childtheme function file and it doesn’t work πŸ™

    #997959
    Tom
    Lead Developer
    Lead Developer

    I just added a second function above: https://generatepress.com/forums/topic/smooth-scroll-effect-on-home-logo-in-menu/#post-997548

    Can you give it a try?

    Let me know πŸ™‚

    #997980
    Eric

    Yesss ! It works now ! Thanks a lot

    #998001
    Tom
    Lead Developer
    Lead Developer

    You’re welcome πŸ™‚

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.