trusktr
trusktr

Reputation: 45464

jQuery: How do I scroll the body without showing the scroll bar?

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

Upvotes: 1

Views: 721

Answers (1)

otakustay
otakustay

Reputation: 12395

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.

Upvotes: 2

Related Questions