I'm trying to hide the scroll bar of the document (in some browsers it's the body element, in others it's the html element) by using overflow:hidden;
. Then i'm using jQuery.animate() to try and animate the scrollTop property. It works fine when the scroll bar is visible (i.e. without the overflow:hidden;
style) but doesn't work when the scroll bar is hidden. Why is that? I'll be able to post a link to a snapshot of the problematic page in a bit...
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Try make <body>
overflow:hidden
and animate the margin-top
property, note the margin-top
should be negative if you want a positive scrollTop.
On webkit you could use ::-webkit-scrollbar: { display: none; }
to hide the scrollbar with scroll features enabled.