How to solve the select overlap bug in IE6?

后端 未结 10 1499
别跟我提以往
别跟我提以往 2021-02-02 09:43

When using IE, you cannot put an absolutely positioned div over a select input element. That\'s because the select element is considered an ActiveX object and is on top of every

相关标签:
10条回答
  • 2021-02-02 09:43

    When hiding the select elements hide them by setting the "visibility: hidden" instead of display: none otherwise the browser will re-flow the document.

    0 讨论(0)
  • 2021-02-02 09:45

    I don't think there is. I've tried to solve this problem at my job. Hiding the select control was the best we could come up with (being a corporate shop with a captive audience, user experience doesn't usually factor into the PM's decisions).

    From what I could gather online when looking for a solution, there's just no good solution to this. I like the FogBugz solution (the same thing done by a lot of high-profile sites, like Facebook), and this is actually what I use in my own projects.

    0 讨论(0)
  • 2021-02-02 09:46

    Mootools has a pretty well heshed out solution using an iframe, called iframeshim.

    Not worth including the lib just for this, but if you have it in your project anyway, you should be aware that the 'iframeshim' plugin exists.

    0 讨论(0)
  • 2021-02-02 09:51

    I do the same thing with select boxes and Flash.

    When using an overlay, hide the underlying objects that would push through. It's not great, but it works. You can use JavaScript to hide the elements just before displaying an overlay, then show them again once you're done.

    I try not to mess with iframes unless it's absolutely necessary.

    The trick of using labels or textboxes instead of select boxes during overlays is neat. I may use that in the future.

    0 讨论(0)
  • 2021-02-02 09:58

    I don't know anything better than an Iframe

    But it does occur to me that this could be added in JS by looking for a couple of variables

    1. IE 6
    2. A high Z-Index (you tend to have to set a z-index if you are floating a div over)
    3. A box element

    Then a script that looks for these items and just add an iframe layer would be a neat solution

    Paul

    0 讨论(0)
  • Thanks for the iframe hack solution. It's ugly and yet still elegant. :)

    Just a comment. If you happen to be running your site via SSL, the dummy iframe tag needs to have a src specified, otherwise IE6 is going to complain with a security warning.

    example:

    
        <iframe src="javascript:false;"></iframe>
    
    

    I've seen some people recommend setting src to blank.html ... but I like the javascript way more. Go figure.

    0 讨论(0)
提交回复
热议问题