I have a small problem with the behavior of the following code. When you click the link (run the code in your browser to see), a small div appears (the hover div). I need this div to appear in *front* of the scrolling area, not within it. In IE, that is possible if you remove the "position:relative;" from the first div. However, if I do that, another bug is produced (in IE only) on my site, so I need to keep that there. But either way, I can't get it to appear in front of the scrolling area in FF.
Any help would be extremely appreciated! Thanks!
Here's the complete code, from <html> to </html>:
Expand|Select|Wrap|Line Numbers
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html>
- <head>
- <title>hover div bug test</title>
- </head>
- <body style="FONT-FAMILY:Arial; color:#000; font-size:10pt;">
- <script type="text/javascript">
- function toggleHover()
- {
- var h = document.getElementById("hover");
- var w = document.getElementById("wrapper");
- if(h.style.display == "none")
- {
- h.style.top = w.clientHeight + 5 + "px";
- h.style.display = "";
- }
- else h.style.display = "none";
- }
- </script>
- <div style="width:150px; height:150px; border:solid 5px #ccc; overflow-y:auto; overflow-x:hidden; padding:10px; margin:10px; z-index:0; position:relative;">
- <div id="wrapper" style="float:left; position:relative;">
- <a href="javascript:toggleHover()">Click Me</a>
- <div id="hover" style="background-color:#eee; border:solid 2px #000; position:absolute; top:0; left:0; z-index:9999; width:275px; padding:10px; FONT-FAMILY: Arial, Helvetica, Verdana sans; display:none;">
- Hover div with a set width and a long string of text.
- </div>
- </div>
- <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
- </div>
- <br /><br /><br /><br /><br />
- </html>