【发布时间】:2017-07-25 13:57:33
【问题描述】:
在我的网站中,我制作了粘性标题。
它在每个浏览器上都运行良好,但是当我在 Chrome 上的 Macbook 上进行测试时,scrollTop 出现错误
我有我的主标题和一个粘性标题:
我编码:
$(document).on('scroll',function() {
if ($(document).scrollTop() >= 150) {
$('header:not(.sticky)').hide();
$('header.sticky').show();
} else {
$('header:not(.sticky)').show();
$('header.sticky').hide();
}
});
当我滚动到 150 像素时,它会跳到我的页面顶部。
感谢您的帮助!
【问题讨论】:
标签: javascript jquery css google-chrome