我为网页制作了一个侧边栏菜单,该菜单从右侧滑动并将整个页面推向左侧。因此,为了使其最接近具有类似侧边栏菜单的本地移动应用程序 - 我必须禁用主要内容的滚动。所以,我用这段代码做到了:
/* remember the current scroll position */
self.pageScrolledTo = $(window).scrollTop();
/* and build a listener for the scroll event */
$(document).on('scroll',function (e) {
e.stopPropagation();
e.preventDefault();
window.scrollTo(0, self.pageScrolledTo);
});
问题是在 Internet Explorer 和 Google Chrome 中 - 当我显示侧边栏并尝试滚动页面时 - 整个页面都会闪烁。就像它滚动了片刻,然后又回到了同一个位置。在 Firefox 上没问题 - 页面静止不动。
你能帮我解决这个问题吗?...
最后一件事:如果我用溢出来制作html和/或body标签:隐藏;- 在 Internet Explorer 和 Firefox 上,滚动条消失了,但它计算元素与旧右边缘的正确距离......至于某些元素,滚动条仍然存在...... ?? ...