This topic has 4 replies, 2 voices, and was last updated 7 years, 2 months ago ago by Laranz
Hello,
Can you tell me how can I link to a section with an anchor and have an smooth scroll effect. So that the page scrolls slowly down when I click on the link. I don’t want to use One page navigation. I only want to have a link
<a href="#anchor">text</a>
when user click on that link the site scrolls down to:
<div id="anchor">....>/div>
Is there some build in javascript in your theme I can use/ call without adding more javascript.
THANK YOU!
Hi there,
I am delighted to assist you today. You can use this javascript code to get this feature.
$(‘a[href*=#]’).click(function(event){
$(‘html, body’).animate({
scrollTop: $( $.attr(this, ‘href’) ).offset().top
}, 500);
event.preventDefault();
});
Hope I was able to help you with your concern.
How can I limit this to a specific link? Can I add a link class somehow? Thank you :)!!!
Hi,
Yes, you can change the selector of that script to your desired needs.
$(‘a[href*=#]’) to $('.anchor')
Let us know,
Thanks,
laranz.
You must be logged in to reply to this topic.Log in/Sign up