[Resolved] Problem with function window.scroll

Home Forums Support [Resolved] Problem with function window.scroll

Home Forums Support Problem with function window.scroll

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #1139258

    The links in the table of contents (plugin LuckyWP Table of Contents) do not work with the smooth scrolling option activated.
    I contacted the author of the plugin.
    Here is his answer :
    “On your site overridden default function window.scroll. Problem in plugin GP Premium.
    Script https://www.un-jardin-bio.com/wp-content/plugins/gp-premium/general/js/smooth-scroll.js overrided internal function window.scroll (https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll). This results in an error.
    Try contacting to GP Premium plugin support.”
    You can see the problem for exemple here : https://www.un-jardin-bio.com/drainage-jardin/ (The table of contents, located at the beginning of the article, is called “Sommaire”).

    Customer Support

    Hi there,

    do you require the GP smooth scroll function? It can be disabled in the Customizer > General. Let us know.


    Hi David
    Ok, I disabled GP smooth scroll function and it’s ok.
    Thank you


    Glad you were able to resolve this Gilles.

    I ran into the exact same problem today after upgrading LuckyWP Table of Contents on a local site.
    I hope it’s ok that I share this here as a possible alternative work-around for others who might search for the issue. Please let me know and my apologies if not.

    In my case, I wanted to keep the GP smooth scroll functionality for my site. Using the steps below, I was able to have fully functioning smooth scroll for both LuckyWP ToC and my site, using only the GP smooth scroll function.

    First, ensure GP Smooth Scroll is enabled in Customizer > General.

    Next, disable smooth scroll in the LuckyWP plugin settings by unchecking “Enable” in General > Behavior > Smooth Scroll.

    I then placed the following PHP snippet (modified from GP Documentation) into my child theme’s functions.php file:

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

    This applies GP smooth scroll to all hash links on the site, except for the “show/hide” toggle link of LuckyWP Table of Contents. This prevents the page from scrolling to the top when showing or hiding the table, but still scrolls from the links in the table.

    Seems to be working great without any errors here anyway.

    Customer Support

    Glad to hear that Giles.
    Thanks for the share Thornbrand – good solution, thanks again!


    Thank you Thornbrand. It’s better.
    I have another question.
    From my search engine (google), when I click on an article title, the scrolling arrives below the title … I would like it to arrive on this one (so the visitor sees that ‘he arrives at his request).
    (see screenshot: https://a.uguu.se/OD5YuIjhhUvJ_2020-01-23_07-56-12.mp4)
    Is there a solution for this?
    Thank you

    Customer Support

    Tricky one – as the Smooth Scroll option which offsets the Sticky Navigation only works if the jumplink is on the same page.

    This user had a similar issue and provided his JS fix:


    Not tested it so not sure how it behaves with the smooth scroll function.

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