javascript - scroll animation not working properly; when i click the link i get directed but with no animation -
smooth scrolling not working?? when click link scroll element/section takes me directly no smooth scrolling after changing animation speed 5000. scripts correct don't know do
this code below; query , have tagged links '#' tag , created id each of elements properly
$(function() { $('a[href*="#"]:not([href="#"])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html, body').animate({ scrolltop: target.offset().top }, 5000); return false; } } }); });
$(function() { $('a[href*="#"]:not([href="#"])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html, body').animate({ scrolltop: target.offset().top }, 1000); return false; }} }); });
Comments
Post a Comment