Site logo

[Resolved] Smooth Scrool issue

Home Forums Support [Resolved] Smooth Scrool issue

Home Forums Support Smooth Scrool issue

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2511010
    Halil

    Hi,
    I added the snippet below, I took it from here https://docs.generatepress.com/article/generate_smooth_scroll_elements/

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

    Smooth scrool was not working in TOC block, adding the above snippet solved the issue however this time, it caused another issue, “Load More” button takes you to the top of the site, instead of showing more blog posts.

    How can I solve this, could you pls help?

    #2511401
    Ying
    Staff
    Customer Support

    Hi Halil,

    Can you try modifying the code to this:

    add_filter( 'generate_smooth_scroll_elements', function( $elements ) {
      $elements[] = 'a[href*="#"]:not(.load-more > .button)';
      
      return $elements;
    } );
    #2511532
    Halil

    perfect, thanks Ying 👍

    #2511598
    Ying
    Staff
    Customer Support

    No Problem, glad to help 🙂

    #2533360
    Jason

    Felt important to share this tiny snippet of CSS for folks still struggling with smooth-scroll…

    I could not get smooth scroll to work with the default theme settings, or specifying the special class, on buttons. I didn’t want to edit php files because it seemed like overkill, nor I wasn’t looking for class filtering. I just wanted SMOOTH SCROLLING on tap for any anchor link, button, or div on the website.

    In your “Additional CSS” simply add the snippet below. View source on Chrome dev tools and inspect the white hero button at https://webassistant.me/.

    html {
      scroll-behavior: smooth;
    }
    #2533517
    Ying
    Staff
    Customer Support

    Thank you Jason for sharing this 🙂

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