IE6 fix for select box over absolute positioned element
IE6 sux. General css/javascript hover drop-down menu uses a div or ul with position:absolute. No matter how much you increase the value of z-index the select box (windowed element) will always remain on top most – yes only on a special browser, Internet Explorer 6. The reason is IE6 considers select element as windowed element and keeps it always on top layer.

Solution is using iframe on top of select element, as iframe is also a windowed element placing it on top of select box fix the problem.

Here is the typical HTML code for this drop-down menu:
<div class="top-menus" style="left: 221px; top: 127px;">
<iframe frameborder="0" scrolling="no" align="bottom" marginheight="0" marginwidth="0" src="javascript:'';" style="height: 200px;"></iframe>
<ul>
<li><a href="#">Bracelets</a></li>
<li><a href="#">Rings</a></li>
<li><a href="#">Earrings</a></li>
<li><a href="#">Necklaces</a></li>
</ul>
</div>
The inline css is calculated using jQuery offset() function. FYI, you can easily get the width,height,left,top position of any element using jQuery(“element”).offset(). Make sure the width and height of the iframe is exactly same of it’s overlying UL element. If you apply any border to the UL, you have to consider that during calculating the proper width/height of the iframe.
This is the sample jQuery code:
var timer = null; // global
$("#top-nav a").hover(function(){
clearTimeout(timer);
$("#top-nav a:not('.cur')").removeClass("selected");
$(this).addClass("selected");
var o = $(this).offset();
var left = o.left + 1; // 1px extra for border
var top = o.top + 32; // 32px for placing it just below the horizontal menu
if($(".top-menus").length){
if(left == $(".top-menus").offset().left)
return;
else $(".top-menus").remove();
}
$("body").prepend('<div style="left:'+left+'px;top:'+top+'px;" class="top-menus"><iframe src="javascript:\'\';" marginwidth="0" marginheight="0" align="bottom" scrolling="no" frameborder="0"></iframe><ul>'+html+'</ul></div>');
$(".top-menus").find(".parent, .child").remove();
var hi = $(".top-menus").find("ul").height();
$("iframe").height(hi + 2); // extra 2px for border
}, function(){
clearTimeout(timer);
timer = setTimeout(function(){$("body").find("iframe,.top-menus").remove(); $("#top-nav a:not('.cur')").removeClass("selected");},300);
});
$(".top-menus").live("mouseover",function(){
clearTimeout(timer);
}).live("mouseout",function(){
clearTimeout(timer);
timer = setTimeout(function(){$("body").find("iframe,.top-menus").remove(); $("#top-nav a:not('.cur')").removeClass("selected");},300);
});
I know this code won’t exactly fulfill your requirement, you can get the main idea from this and write your own code yourself. You can see it in action on www.trendtogo.com.
Related posts:
- jQuery Drop down menu without setTimeout
- A better process to find maximum z-index within a page
- CSS Equal Height Columns
- Javascript timer – advanced features, simple to use
- IE6 png alpha transparency fix for dynamically loaded images via ajax



My Elance Profile