1

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...

trusktr
  • 44,284
  • 53
  • 191
  • 263

1 Answers1

2

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.

otakustay
  • 11,817
  • 4
  • 39
  • 43
  • Seems like the only way (besides in Chrome) is to hack it using margins. Thanks! – trusktr Jun 06 '12 at 05:27
  • speaking of hacking with margins, see http://stackoverflow.com/questions/5872194/how-can-i-scroll-through-a-div-without-the-scrollbars-showing – cboettig Jul 31 '13 at 23:13