The CSS Z-index Property Pop-up Method

Test this pop-up method: Using the CSS Z-index Property Pop-up Method

Windows IE: OK
Windows Firefox: OK
Windows Safari: OK
Windows Opera: OK
Mac IE: OK
Mac Firefox: OK
Mac Safari: OK


This one is pretty straightforward: Just change the layer the pop-up is on to get it in front of everything else to show it, then change it back to hide it. Note that we used a full screen overlay whose id="q" to give the pop-up something to hide behind.

You may use this technique to present pop-up ads, or to solicit subscribers to your ezine, newsletter, or RSS feed. Use if for reminders, warnings, or statistics displaying. You may get survey participants, ask for donations, or use it for political fund raising. You can even inform visitors about some of your other related websites. There is no end to the types of purposes that pop-ups can be used for.

If your pop-up is about thumbnail enlargement, check out What is the easiest way to do thumbnail image enlargement windows? If you want thumbnail enlargement without clicking, check out Making an Image Enlarge When The Mouse Cursor Is Hovering Over It.


<head><title>The CSS Z-index Property Pop-up Method</title>
<script type="text/javascript">

function show(l){e=document.getElementById('o');;}


<div id="q" style="position:absolute; left:0px; top:0px; width:100%; height:100%;background-color:#eee;z-index:1"></div>

<div id="r" style="position:absolute; left:50px; top:50px; width:50px; height:50px;z-index:9">
<IMG SRC="doorknob.gif" WIDTH=50 HEIGHT=50 BORDER=0 onMouseOver="javascript:show(9);return true" onMouseOut="javascript:show(-1);return true"></div>

<div id="o" style="position:absolute; left:200px; top:100px; width:400px; height:400px;z-index:-1"><IMG SRC="doorknob-big.gif" WIDTH=400 HEIGHT=400 BORDER=0></div>