【发布时间】:2012-09-30 19:30:57
【问题描述】:
我正在尝试使用 jquery 在单击链接时轻松滚动到锚点。但我不希望它一直滚动到顶部。它必须在距离顶部至少 90px 处停止,这样锚定的 div 就不会落后于我的 90px 高的固定标题菜单栏。有什么想法吗?
$(function() {
$('a').bind('click',function(event){
var $anchor = $(this);
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 1500,'easeInOutExpo');
event.preventDefault();
);
});
【问题讨论】:
标签: jquery jquery-animate bind scrolltop