- This topic has 6 replies, 3 voices, and was last updated 4 years, 2 months ago by David.
-
AuthorPosts
-
January 21, 2020 at 7:14 am #1139258Gilles
Hello
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”).
Thanks
GillesJanuary 21, 2020 at 11:56 am #1139546DavidStaffCustomer SupportHi there,
do you require the GP smooth scroll function? It can be disabled in the Customizer > General. Let us know.
January 21, 2020 at 12:24 pm #1139570GillesHi David
Ok, I disabled GP smooth scroll function and it’s ok.
Thank you
GillesJanuary 21, 2020 at 2:09 pm #1139655JeremyGlad 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.
January 21, 2020 at 4:11 pm #1139728DavidStaffCustomer SupportGlad to hear that Giles.
Thanks for the share Thornbrand – good solution, thanks again!January 22, 2020 at 11:10 pm #1140990GillesHello
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
GillesJanuary 23, 2020 at 6:41 am #1141351DavidStaffCustomer SupportTricky 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:
https://generatepress.com/forums/topic/anchor-links-load-behind-sticky-header/#post-991786
Not tested it so not sure how it behaves with the smooth scroll function.
-
AuthorPosts
- You must be logged in to reply to this topic.