I want a smooth scroll to internal links. Works fine in firefox, but in Chrome I get an error "body.scrollTop is deprecated in strict mode"
My code was
$(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;
}
}
});
});
The problem, however, is after I changed this
$('html,body').animate({scrollTop: target.offset().top}, 1000);
to
$('html').animate({scrollTop: target.offset().top}, 1000);
the links don't work at all, and there is no error / warning in the console.