I have for quite some time thought that the only way to drop down over a select in IE was to hide it. Lately though, it has come to my attention that yes, one can construct an iframe 'shim' for the drop down. This can be rather tricky in practice but the principal is easy enough. The advantage is that it looks much more professional than hiding the select, especially when a drop down would otherwise only partially cover the select. Now this will only work in IE5.5 pc/win plus and may no longer be needed and in fact could be a problem in IE7. That and the fact that it looks bad in FF and will obscure the drop down in Opera is what makes it so tricky. The principal is to make an iframe that can be displayed under the drop down, make it the same height and width and display it at the same coordinates and have its z-index less than the drop down. That's all there is to it, basically. I modified DD's anylink drop down menu to do this and shielded the iframe from other browsers, including IE7, using an iframe set in two IE conditional comments in the head of the page before any scripts that would use it:
Code:
<!--[if lte IE 6]>
<!--[if gte IE 5.5]>
<iframe id="dropmenuiframe" src="" style="z-index:99;display:none;position:absolute;"></iframe>
<![endif]-->
<![endif]-->
You will note that the iframe has a z-index of 99 so the drop down(s) will need a z-index of 100 or more. In the javascript code, I created a global variable:
Code:
var ie5_5=typeof dropmenuiframe=='undefined'? 0 : 1
This variable can then be tested before performing any operations connected to the iframe:
Code:
if (ie5_5) {
do iframe stuff here
}
I realize this is complicated but the results are worth it.
Bookmarks