$(document).ready(function(){
$('a[href*=#]').bind("click", function(e){
var anchor = $(this);
$('html, body').stop().animate({
scrollTop: $(anchor.attr('href')).offset().top
}, 1000);
e.preventDefault();
});
return false;
});
если честно я не совсем до конца понимаю как работает этот скрипт, а точнее эта часть
$('html, body').stop().animate({
scrollTop: $(anchor.attr('href')).offset().top
}, 1000);
e.preventDefault();
});
return false;
});
в общем он должен работать для любого якоря и делать плавную прокрутку к нему.... но увы... файр баг молвит мне о такой ошибке
Uncaught TypeError: Cannot read property 'top' of undefined index.html:45
(anonymous function) index.html:45
x.event.dispatch jquery.js:5
v.handle