- This topic has 23 replies, 2 voices, and was last updated 3 years, 10 months ago by
Ying.
-
AuthorPosts
-
July 6, 2018 at 6:06 am #617185
Junior Gong
Is there any way to enable Smooth Scroll for all anchor links on whole site?
July 6, 2018 at 6:11 am #617192David
StaffCustomer SupportThe current method is by adding the
smooth-scrollclass to the<a>tag. How many anchor links do you have?July 6, 2018 at 6:14 am #617196Junior Gong
Example: I am using TOC plugin which generates anchor links automatically.
I cannot add any classes to the anchor links generated.Therefore my solution is to enable smooth scroll for all links
July 6, 2018 at 6:24 am #617205David
StaffCustomer SupportCan you share a link to the site, so we can see the mark-up that TOC is creating, might be a way to filter that and add the smooth-scrool class or use one of its classes instead…… maybe 😉
July 6, 2018 at 6:47 am #617222Junior Gong
Is there any way to share the link privately? My client does not want to have links in wordpress related public forums etc..
July 6, 2018 at 6:53 am #617237David
StaffCustomer SupportYes, Edit your your original post up the top and there is a Site URL field that only us admins can see
July 6, 2018 at 6:59 am #617250Junior Gong
done!
July 6, 2018 at 8:16 am #617384David
StaffCustomer SupportI am going to check with Tom if there is a way that the smooth-scroll script can work on all
<a>tags within the content. Whilst looking for a decent content filter that could add the class as an alternative.July 6, 2018 at 2:20 pm #617605Tom
Lead DeveloperLead DeveloperI’ve just added a new filter to GPP 1.7-beta.2:
generate_smooth_scroll_elementsThat will allow us to initiate smooth scroll on other element classes 🙂
July 6, 2018 at 2:29 pm #617609Junior Gong
That is awesome!
Is that gonna work even when an element does not have any class? E.g. just by pointing to an element like in CSS files?
July 6, 2018 at 2:36 pm #617612Tom
Lead DeveloperLead DeveloperWe should be able to target the links as long as they’re wrapped in some sort of container with a class or ID 🙂
July 8, 2018 at 5:50 am #618497Junior Gong
Thx guys, I appreciate the support
December 19, 2018 at 2:42 am #760969Mathias
Awsome! Thank you for sharing this. Smooth-scroll works pretty nice.
December 19, 2018 at 4:04 am #761014David
StaffCustomer SupportHi Mathias, glad you found it of use. This article may be of interest:
March 1, 2019 at 4:51 pm #826087YSK
“generate_smooth_scroll_elements” is a nice filter. I often use this filter.
However, using this filter in IE 11, turning on “Back to Top Button” turns out strange behavior.
When you push the “Back to Top Button”, you will rattle at the beginning and the end.
-
AuthorPosts
- You must be logged in to reply to this topic.