I'm stuck. When clicking on a link in my menu, the menu should close and then there should be a smooth scrolling to the #-link.
My code is working fine on local but not on live-server.
I already checked if jQuery is loaded properly and there are also no errors in the console. Do you have any further ideas?
Here's my code:
$(document).on('click', "a[href^='#']", function(e) {
e.preventDefault();
$('html, body')
.delay(300)
.animate({
scrollTop: $($.attr(this, "href")).offset().top
}, 800);
});
Aucun commentaire:
Enregistrer un commentaire