View Full Version : Disable page.

02-25-2008, 10:19 PM
I have a page, and when the use clicks on a link, it shows a div. But I want to make it so that the rest of the page under the div get's disabled, cant be clicked or scrolled. I'm sure you've seen something like this before. I'm not sure what i'm supposed to use, so i'm hoping html/css is the right place.

02-25-2008, 10:57 PM
do you have an example page where you have seen this. It sounds like a jasvascript problem.

02-25-2008, 11:04 PM
Don't worry I figured it out. Or at least I have a plan, if it doesn't work i'll be back:


Create a div to fille the page, and color it grey. Set it's z-index to 0, everything else to 1. When the div I want to show pops up, I set it's z-index to 3, and the grey div to 2. That way, the div covers everything, and takes all the mouse input. Job done, or so I hope. 2 minutes thanks.

02-25-2008, 11:09 PM
Kind of like thickbox (http://jquery.com/demo/thickbox/)? Check out the demos.

02-25-2008, 11:18 PM
Yes like that, but I don't want something I havn't made on here unless it's... really impossible for me to do. Also, thats way too much, I just want to shade the background so my div is there. Anyway question is:

#pageCover {
width: 100%;
height: 100%;
background: orange;
position: absolute;
top: 0px;
left: 0px;
z-index: 3;

It only stretches as high as the page thats visible, so if you scroll down you can see the page. Is there a way to make it stretch the full length of the actual page, i know there is a javascript way. But before I jump at it is there a simple css property?

02-25-2008, 11:27 PM
Make it position:fixed. IE6 doesn't support position:fixed; so you will need to fake it. http://www.cssplay.co.uk/layouts/fixed.html

02-25-2008, 11:38 PM
That kindof, causes other problems. Ok no worries i'll javascript it.

02-26-2008, 12:26 AM
Sorry to keep replying but, how do I disable scrolling? I want to do it temporarily.

02-26-2008, 12:44 AM
You can use javascript.

document['body'].style.overflow = 'hidden';

02-26-2008, 01:06 AM
Nice. All works nice now. :D


Edit: Oh wait... the screen flashes white and jumps all over if you've scrolled down the page. Is there no other way to just disable scrolling?

Another Edit: Never mind, i'll just force it to scroll to the top first.

YET another edit: I don't like the fact the scroll bars disappear, is there no way to just capture and block the scroll wheel?

02-26-2008, 04:55 AM
No there is no way to capture the scroll bar and block the scroll wheel. What exactly are you trying to do anyways? I got the idea of overlay but why stop scrolling?

02-26-2008, 05:21 AM


If you scroll down slightly (i already know that the div to cover the page is visible, i'll fix later) and then click on one of the download buttons. It'll scroll to the top of the page and cover everything with the div. Thing is the scrollbar disappears and it makes everything jerk. I didn't like it.

02-26-2008, 05:27 AM
I understand that but there isn't much you can do about that. What exactly are you trying to do? Why the need to not scroll?

02-26-2008, 05:36 AM
Just niceties I guess. Thank you for the help though

02-26-2008, 05:25 PM
Taking away control from the user isn't nice. It's mean. They won't give you cookies after, either.