最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - IE 6 select controls(Combo Box) over menu - Stack Overflow

programmeradmin1浏览0评论

In IE 6 select control(combo box) is displaying on top of menus. I checked some Javascript menus, mmmenu, but all are getting under select control. It's not fixable by assigning Z-Index. Is there any other solution.

In IE 6 select control(combo box) is displaying on top of menus. I checked some Javascript menus, mmmenu, but all are getting under select control. It's not fixable by assigning Z-Index. Is there any other solution.

Share Improve this question edited Nov 23, 2011 at 1:27 Jonathan Leffler 754k145 gold badges946 silver badges1.3k bronze badges asked Feb 16, 2009 at 5:24 Priyan RajeevanPriyan Rajeevan 1,0521 gold badge15 silver badges26 bronze badges
Add a comment  | 

4 Answers 4

Reset to default 7

This is a well-known bug with IE6 with trying to absolutely position divs on top of select controls.

There are workarounds involving iframe shims, but there is no good answer. The iframe shim answer is to place an iframe underneath whatever div you're trying to place above a select, with the iframe being the same size. Unfortunately, this is a huge pain in the ass.

I suggest using a javascript menu system which already uses iframe shims, such as YUI menus (and I assume jQuery).

Most of the major javascript libraries have easy to implement solutions to this problem. We use jQuery, and the bgiframe plugin is very easy-to-use and solves the problem.

Daniel is definitely right. This is an ugly issue.

However, there may be another solution. If you are using multi-tiered menus that pop open and closed, it is possible to write JavaScript code that literally hides the problematic SELECT elements when the popup is opened (style the element to have a visibility of hidden). Then when the menu closes you can unhide that same SELECT control.

Then you just have to write code that detects which SELECT objects get in the way of a particular menu before it opens. It's not trivial code, but it's definitely possible to write. Then I'd just wrap the entire chunk of code in a conditional that checks to see if the user is on IE as there's no need to run this on Firefox or Safari.

The problem is that SELECT are "windowed" elements in IE6, and their z-index is above all the other non-"windowed" components. If you absolutely must have something above a combox, you might want to put it inside another windowed compnent, such as an IFRAME, and set the component's z-index to be higher than that of the combobox.

I must admit, this isn't a pretty solution.

发布评论

评论列表(0)

  1. 暂无评论