【发布时间】:2013-11-21 11:57:07
【问题描述】:
使用我的 javascript 代码,我可以滚动到一个 div,但我需要 javascript 让我比那个 div 高 20 像素。我的代码是这样的
$(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;
}
}
});
});
有人能让10px 比div 高吗?非常感谢
如果您想更具体地了解http://www.sventasticable.nl 的问题,这是我的网页
我的英语不是很好。
【问题讨论】:
标签: javascript html margin pixels