Jump to content

black out/disable window onClick


mark_nsx

Recommended Posts

Hi there! I would like to know how to go about blacking out/disabling the whole window
when a user triggers an onClick event just like in thefind.com (click Login or Add a Product
at the bottom of the page). Any ideas guys? Cheers!

Here's the URL: http://thefind.com/main/query.php?qS=usr&query=nike
Link to comment
Share on other sites

I got the opacity sorted out and disabling of the scrollbars (overflow: hidden), but how do they manage to show the login popup? I have tried appending my form's code in the body innerHTML but I end up with the form having blacked out as well. Thanks for the help! Cheers =)
Link to comment
Share on other sites

i would do it like this:
first the css:
[code]
body, html{
  width:100%;
  height:100%;
  overflow:hidden;
}

div#black_out{
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
background:#888;
opacity:0.5;
filer:alpha(opacity=50);
-moz-opacity:0.5;
}[/code]

js:

[code]
function blackOut(){
var div = document.createElement('div')
div.id = 'black_out' // or div.setAttribute('id','black_out')
document.body.appendChild(div)
}

function hideBlackOut(){
var div
if (div = document.getElementById('black_out')
    document.body.removeChild(div)
}

function showDialog(){
blackOut()
// code for dialog...
return false
}

function hideDialog(){
hideBlackOut()
// -- code for hiding the dialog
}
[/code]

html:

[code]
<a href="javascript:showDialog()">show dialog</a>
<!-- OR -->
<a href="#" onclick="showDialog()">show dialog [onclick]</a>
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.