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
https://forums.phpfreaks.com/topic/32524-black-outdisable-window-onclick/
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 =)
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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.