views:

74

answers:

3
<div style="background-color:grey">
</div>

Is there an easy way to do it?

+1  A: 

While doing so, you want to disable the user/input?

Check this: http://malsup.com/jquery/block/

Blocking elements: http://malsup.com/jquery/block/#element

Blocking whole page: http://malsup.com/jquery/block/#page

Rgds

effkay
I need simple lines to do this job.Not a plugin.
sure; then check jeerose's reply. However, it will not overlay the drop downs and activeX components such as flash or javaapplet.
effkay
+1 effkay - that's correct (re: activeX). @user198729 you do need a plugin for that unless you want to do LOTS of programming!
jeerose
That's fine for me,because for the time being,there is no need to worry about activeX or flash.
A: 

To make it fullscreen, set these styles:

position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;

To put it on top, set the z-index value to something higher than the rest of the elements on the page.

z-index: 99;

You can set all these with a stylesheet, then just use jQuery to show/hide the div.

Corey
A: 

Define a style overlay or something like so:

<style>
  .overlay {  
    position:absolute;
    top:0;
    left:0;
    width:100%;
    height:100%;
    z-index:1000;
  }
</style>

Then you can add the new class like this using jQuery:

$('#myDiv').addClass('overlay');

If you want to add with a click event you would do something like this:

$('a').click(function(){
  $('#myDiv').addClass('overlay');
}

Or, you could add display:none to the .overlay class so it's hidden on page load, then have your jQuery click function show it like this:

$('a').click(function(){
  $('.overlay').show('slow');
}
jeerose
How to put all those css parts into jQuery?
no need to put them; just define the class in your CSS file; and then in your Javascript,make this call "$('#myDiv').addClass('overlay');". It will automatically add all these attributes
effkay