Tagged: enfold theme, named anchors, smooth scroll
-
AuthorPosts
-
May 30, 2021 at 10:22 pm #1303037
Hi
I don’t know if this is the right term in English, but I would like to deactivate the “page down / page up” effect when you click on an anchor on a page.
On a short page this is fine – but on a long page with alternating white / black color sections it is horrible to the eyes.Deactivation for all the site. I click on an anchor > I arrive on the id/anchor with no effect. Or a very speed effect perhaps / and-or with a fade in.
Thank you.
Best regards
SebJune 1, 2021 at 7:37 am #1303345Hey Astaryne,
Thank you for the inquiry.
You might be referring to the smooth_scroll function. To deactivate it, please edit the js > avia.js file and remove the code which is located around line 95.
//smooth scrooling if( $.fn.avia_smoothscroll ) { $('a[href*="#"]', container).avia_smoothscroll(container); }
Please toggle or temporarily disable the Enfold > Performance > File Compression settings.
Best regards,
IsmaelJuly 21, 2023 at 9:57 pm #1414000For the function:
//smooth scrolling if( $.fn.avia_smoothscroll ) { $('a[href*="#"]', container).avia_smoothscroll(container); }
Can this function be modified to add a smooth scroll to an anchor link that is on another page? For example if there is a / that occurs before the hash because the anchor is on another page:
if( $.fn.avia_smoothscroll ) { $('a[href*="#"]', container).avia_smoothscroll(container); $('a[href*="/#"]', container).avia_smoothscroll(container); }
If so, should I do this rewrite in the child theme? (I understand that I need to keep the same file structure in the child theme as the parent theme)
I am not proficient with javascript, so please excuse any laughable errors on my part.
Thanks in advance!
- This reply was modified 1 year, 4 months ago by rlhinirv57.
July 23, 2023 at 9:43 pm #1414175Hi,
Thanks for your question, the current a[href*=”#”] is correct for links to another page, the reason that it doesn’t work as expected is that browser match the hash on page load, the way around this is to remove the hash from the url and load the page at the top with window.scrollTo(0, 0); and then add the hash to smooth scroll to it.
Instead of reinventing the wheel try the plugin Page scroll to id and in the settings try Scroll duration of 1500 and an Offset of 125 and leave all of the other default settings.
You may notice the page reset as I explain earlier so if you want to avoid this your the Enfold Theme Options ▸ Page Preloading it will hide the page reset and then you will see the smooth scroll to the ID when coming from another page, and when going to an ID on the same page the Page Preloading will not show and the page will smooth scroll to the ID.Best regards,
MikeJuly 25, 2023 at 12:12 am #1414281Hello Mike,
Thank you! I was previously unaware of that plugin – I did install it and everything works as wanted. It’s exactly the solution I needed!
Kind regards,
RhondaJuly 25, 2023 at 1:55 am #1414286Hi Rhonda,
I’m glad that Mike could help you :)
Thanks for using Enfold and have a great day!Best regards,
Nikko -
AuthorPosts
- The topic ‘Disable effect > Go to anchor’ is closed to new replies.