Hi,
I’ve a problem with jQuery function.
I want to add smooth scrolling when clicking an anchor link to my website..
I’ve put the following code to my php template file, but when i click to the link nothing happens
<script>
function goToByScroll(id){
// Reove "link" from the ID
id = id.replace("link", "");
// Scroll
$('html,body').animate({
scrollTop: $("#"+id).offset().top},
'slow');
}
jQuery("#animated > a").click(function(e) {
// Prevent a page reload when a link is pressed
e.preventDefault();
// Call the scroll function
goToByScroll($(this).attr("id"));
});
</script>
Can you help me?
Thanks
Regards,
Salvatore
Hey integraing!
Enfold already has a smooth scroll function. Please see – http://kriesi.at/documentation/enfold/add-anchors-to-your-page-for-single-page-navigation/
Cheers!
Yigit