Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make transparent overlay on page Jquery

Tags:

jquery

overlay

Hey, how can I make it so that there's basically just a semi transparent color covering the whole page except for 1 div (which is going to be a message)

Basically, page loads background gets covered with semi transparent blackness but a certain div (message box in this case) stays normal.

Thanks

like image 369
Belgin Fish Avatar asked Jul 08 '10 02:07

Belgin Fish


2 Answers

You could try blockUI http://malsup.com/jquery/block/

The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser[1]. When activated, it will prevent user activity with the page (or part of the page) until it is deactivated. BlockUI adds elements to the DOM to give it both the appearance and behavior of blocking user interaction...

[1] Using the XMLHttpRequest object in synchronous mode causes the entire browser to lock until the remote call completes. This is usually not a desirable behavior.

like image 166
Matt Evanoff Avatar answered Sep 23 '22 12:09

Matt Evanoff


Do something like this:

html

  <div id="lightbox_background"> 
    <div id="lightbox_container"> 
      <div id="lightbox_header"> 
        <span class="close"><a href="javascript:void(0);" onclick="activity_feed_close()">close</a> <a href="javascript:void(0);" onclick="activity_feed_close()"><img src="http://design.vitalbmx.com/images/x_button.gif" /></a></span> 
      </div> 
      <div id="lightbox_content"> 
        <p>Some text</p>
      </div> 
    </div> 
  </div> 

css

<style type="text/css">
div#lightbox_background { 
    display:none; 
    position:fixed; 
    top:0; 
    left:0;
    height:100%; 
    width:100%; 
    background: transparent url(http://design.vitalbmx.com/images/transp_30.png) repeat; z-index:1100; 
} 
div#lightbox_container { 
    background: #f6f6f6 url(http://design.vitalbmx.com/images/lb_container_bg.gif) right top repeat-y; 
    margin:16px 32px; 
} 
div#lightbox_container div#lightbox_header { 
    padding:5px 5px 0; text-align:right; 
} 
div#lightbox_container div#lightbox_content { 
    width:100%; 
    min-height:500px; 
}
</style>​ 
like image 39
mvbl fst Avatar answered Sep 22 '22 12:09

mvbl fst