D
dd
Does anyone have a cross-browser solution for hiding
scrollbars and/or disabling scroll for the whole page?
When the user clicks something, I want to display a
DIV that fills the whole client area. While this DIV
is displayed, they can close it by clicking the close
button on the DIV. During the time this DIV is visible
though, I don't want them to be able to scroll (and
they usually can scroll because the page itself is
typically longer than the height of the browser). If
scrolling is allowed, then the DIV has to fight to keep
in a visible position and it looks ugly. Currently I hook
into the scroll event and constantly reposition the DIV
so it's filling the browser screen (by adjusting the top
and left offsets of the DIV to match the scroll amounts).
I had in mind the idea of hooking into the scroll event
and canceling the event but it seems a bit heavy
handed. I'd rather try and hide the scrollbar temporarily.
Ideally the solution would also somehow disable the
mouse scrollwheel (both modes of operation) too. If
blocking the mouse scrollwheel isn't so easy, it's not
such a biggie. It's the scrollbar that's the most important.
I have seen some pages do this in the past but I
can't seem to find any examples right now.
scrollbars and/or disabling scroll for the whole page?
When the user clicks something, I want to display a
DIV that fills the whole client area. While this DIV
is displayed, they can close it by clicking the close
button on the DIV. During the time this DIV is visible
though, I don't want them to be able to scroll (and
they usually can scroll because the page itself is
typically longer than the height of the browser). If
scrolling is allowed, then the DIV has to fight to keep
in a visible position and it looks ugly. Currently I hook
into the scroll event and constantly reposition the DIV
so it's filling the browser screen (by adjusting the top
and left offsets of the DIV to match the scroll amounts).
I had in mind the idea of hooking into the scroll event
and canceling the event but it seems a bit heavy
handed. I'd rather try and hide the scrollbar temporarily.
Ideally the solution would also somehow disable the
mouse scrollwheel (both modes of operation) too. If
blocking the mouse scrollwheel isn't so easy, it's not
such a biggie. It's the scrollbar that's the most important.
I have seen some pages do this in the past but I
can't seem to find any examples right now.