Jump to content

Disable scrolling?


ShadowMage

Recommended Posts

Is it possible to somehow disable scrolling but keep the scrollbar?The reason I ask is that the way I'm doing it now (setting overflow: hidden; on the body) produces an odd little jitter in the page when the scrollbar disappears.

Link to comment
Share on other sites

Would it work to set overflow to scroll, and set both the html and body elements to 100% height? Be careful, though or IE could end up with 2 sets of scrollbars.(I haven't done this lately, but some combination in there does it, I think.)

Link to comment
Share on other sites

Would it work to set overflow to scroll, and set both the html and body elements to 100% height? Be careful, though or IE could end up with 2 sets of scrollbars.(I haven't done this lately, but some combination in there does it, I think.)
Well, it didn't create 2 scrollbars. :) Unfortunately, it also did not disable scrolling... :) I'll play around with some different combinations to see if I can get something to work.
Link to comment
Share on other sites

This is the magic combination:document.body.style.overflow = "hidden";document.documentElement.style.overflow = "scroll";document.body.style.height = "100%";document.documentElement.style.height = "100%";If you have padding on the body (which I do) you'll also have to use box-sizing: border-box; on the body element.Thanks for pointing me in the right direction, DD! :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...