[Resolved] Scroll Behavior not working

Home Forums Support [Resolved] Scroll Behavior not working

Home Forums Support Scroll Behavior not working

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1345287
    Elia

    Hi there,

    We are using the gutenberg anchor links. And we want to make them smooth. What is the best way for that?

    We enable smooth scroll on the options:
    https://docs.generatepress.com/article/smooth-scroll/

    But it doesn’t work out of the box

    Many thanks

    #1345409
    David
    Staff
    Customer Support

    Hi there,

    smooth scroll works when the link element has the smooth-scroll class – see here for reference:

    https://docs.generatepress.com/article/smooth-scroll/#regular-links

    But you can add the PHP Snippet provided here so it applies to any <a> element:

    https://docs.generatepress.com/article/generate_smooth_scroll_elements/

    #1345429
    Elia

    Thanks a lot, David! Top class as usual

    #1345451
    David
    Staff
    Customer Support

    glad to be of help

    #1346034
    Juan

    Hi!
    And sorry for adding another comment here, but I actually happen to have the same problem:

    I have added the “smooth-scroll” class in some anchor links that I already had, example:
    <a href="#Indice">Volver al Índice</a>

    Editing the message after checking that the html of the anchor text is tranform into the anchor text itself: As I read in https://docs.generatepress.com/article/smooth-scroll/#regular-links I just added ” class=”smooth-scroll” ” in between de “a” and the “href”.

    But it is not working… The link works, but not the smooth scroll

    Also, and I don´t know if I have done it well, I have added the following code in the “functions.php” (I´m using a child theme and I read I could do this).

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

    But it is not working either… I´m using the lazy load functionality that comes with the plugin “smush image”, I don´t know if thats related but I have seen you were talking about it in anothe thread in this forum. XD

    Thanks in advance for your help!

    Juan

    #1346235
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Any chance you can link us to your page so we can take a look?

    Let me know 🙂

    #1346265
    Juan

    Hi Tom,

    Of course!
    The site is https://quever-grecia.info/ and the anchor text I mentioned is repeated a few times in the homepage.

    Let me know if I can provide you with more info

    #1346581
    David
    Staff
    Customer Support

    Hi there,

    is the Smooth Scroll option enabled in Customizer > General?

    And can you disable your litespeed cache so we can see whats happening

    #1346740
    Juan

    Hi David!

    I´m very sorry, the smooth-scroll option was NOT enabled where you said. I didn´t even know it existed there and it looks like I missed the most basic point… Thanks a lot for your help and now it´s working as it should. 🙂

    Regards

    Juan

    #1346839
    David
    Staff
    Customer Support

    Glad to hear that 🙂

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