Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iframe shimming or ie6 (and below) select z-index bug

Uhm I'm not sure if anyone has encountered this problem
a brief description is on IE6 any <select> objects get displayed over any other item, even div's... meaning if you have a fancy javascript effect that displays a div that's supposed to be on top of everything (e.g: lightbox, multibox etc..) onclick of a certain element and that div overlaps a <select> your div get's to be displayed as if it's under the <select> [on this case a max and minimum z-index doesn't work ]

I've tried googling and found the iframe shim solution
but I wanted some pretty clean alternatives or better yet has anyone found a better solution? since the method using iframes uses around 130mb of ram might slow down poor people's machines

like image 829
lock Avatar asked Oct 22 '08 04:10

lock


3 Answers

You don't have to hide every select using a loop. All you need is a CSS rule like:

* html .hideSelects select { visibility: hidden; }

And the following JavaScript:

//hide:
document.body.className +=' hideSelects'

//show:
document.body.className = document.body.className.replace(' hideSelects', '');

(Or, you can use your favourite addClass / removeClass implementation).

like image 164
pawel Avatar answered Nov 13 '22 07:11

pawel


There is a plugin for jquery called bgiframe that makes the iframe method quite easy to implement.

Personally, as a web developer, I'm to the point where I no longer care about the user experience in IE6. I'll make it render as close to "correct" as possible, and make sure it's functional, but as far as speed goes, too bad. They can upgrade. IE7 (though still quite slow, compared to every other browser) has been out for 2 years (almost to the day!). IE8 is going to be out shortly. Firefox is available for every platform. Safari is also an option (and super fast). Opera is available for most/every platform.

IE6 was released in over 7 years ago. IMHO, there is no reason to still be using it, other than lazy users and incompetent IT departments (or if you're a web developer).

like image 3
gregmac Avatar answered Nov 13 '22 06:11

gregmac


in case anyone is interested, here's some IE shimming code.

* html .shimmed {
    _azimuth: expression(
        this.shimmed = this.shimmed || 'shimmed:'+this.insertAdjacentHTML('beforeBegin','<iframe style="filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);position:absolute;top:0px;left:0px;width:100%;height:100%" frameBorder=0 scrolling=no src="javascript:false;document.write('+"''"+');"></iframe>'),
        'inherit');
}

ref: this gist by subtleGradient and this post by Zach Leatherman

like image 2
Aeon Avatar answered Nov 13 '22 06:11

Aeon