我使用了一个页面上几个IDS,所以当你点击菜单链接,它会转到页。我无法添加偏移量。它在滚动时重叠内容。 这里是我的jQuery:锚点标记不能登陆到适当的位置在WordPress
$(document).ready(function() {
if(window.location.hash.length > 0) {
window.scrollTo(0, $(window.location.hash).offset().top);
}
});
我使用了一个页面上几个IDS,所以当你点击菜单链接,它会转到页。我无法添加偏移量。它在滚动时重叠内容。 这里是我的jQuery:锚点标记不能登陆到适当的位置在WordPress
$(document).ready(function() {
if(window.location.hash.length > 0) {
window.scrollTo(0, $(window.location.hash).offset().top);
}
});
尝试添加偏移(最有可能你的头导致错误的滚动位置)是这样的:
$(document).ready(function() {
if(window.location.hash.length > 0) {
window.scrollTo(0, $(window.location.hash).offset().top - 80); //where 80 is your header height
}
});
仍然没有工作:( –
给我们一个链接到你的网站,以便我们进一步调查它。 –
http://hartwigs.simplepixels.com.au/ –
你的代码看起来很好,如果有一些重叠可能是应工作另一个问题? – alpipego
你能向我们展示页面并解释更多的问题吗? –
嗨毯螅,我要与大家分享一个链接,然后,我不能公开分享:(有没有什么办法,我们可以讨论一对一? –