body animate does not stop on hash id code example
Example: body animate does not stop on hash id
jQuery(function($) {
$('a[href*="#"]:not([href="#"])').click(function() {
var target = $(this.hash);
$('html,body').stop().animate({
scrollTop: target.offset().top - 120
}, 'linear');
});
if (location.hash){
var id = $(location.hash);
}
$(window).load(function() {
if (location.hash){
$('html,body').animate({scrollTop: id.offset().top -120}, 'linear')
};
});
})(jQuery);