【发布时间】:2014-09-12 10:03:00
【问题描述】:
我有以下 jQuery 脚本来向下滚动页面。
$(document).ready(function() {
$('a[href^=#]').on('click', function(e){
var href = $(this).attr('href');
$('html, body').animate({
scrollTop:$(href).offset().top
},1500);
e.preventDefault();
});
});
页面有一个高度为 100 像素的固定页眉。显然我需要向下滚动 100 像素,所以标题不会覆盖标题。 我用谷歌搜索,我需要在某处输入“{offset: -100}”.. 但是在哪里?
【问题讨论】:
标签: javascript jquery html css