简体   繁体   English

jQuery SelectBox插件在IE7、8或9中不起作用

[英]jQuery SelectBox Plugin not working in IE7, 8, or 9

I have this jQuery selectBox plugin that I have styled to fit what I need and also a "Go" button to go to the href given in the value of each option. 我有这个jQuery selectBox插件,该插件具有适合我所需样式的样式,还有一个“转到”按钮转到每个选项的值中给出的href。 The functionality and style work beautifully in FF, Chrome, and IE10. 功能和样式在FF,Chrome和IE10中都能完美工作。 However does not work at all in IE7, 8 , and 9. 但是在IE7、8和9中根本不起作用。

I have tried a wide range of things that I've come across in here including making sure there was a z-index on all of my divs using the following jQuery fix: 我尝试了很多我在这里遇到过的事情,包括使用以下jQuery修复程序确保所有div上都有一个z-index:

    $(function () {
        var zIndexNumber = 1000;
        $('div').each(function () {
        $(this).css('zIndex', zIndexNumber);
        zIndexNumber -= 10;
        });
    });

Nothing I have tried has made any difference in IE. 我尝试过的一切都不会对IE产生任何影响。 I'm almost certain my problem exists in my css. 我几乎可以确定我的CSS中存在问题。 I use a lot of css3 styles and have tried removing them...I have yet to come up with a solution. 我使用了很多css3样式,并尝试删除它们。。。我还没有提出解决方案。 Any help at all with this would be greatly appreciated! 任何帮助都将不胜感激! :) :)

HERE IS MY JSFIDDLE: http://jsfiddle.net/defmod33/hX2Ma/ 这是我的JSFIDDLE: http : //jsfiddle.net/defmod33/hX2Ma/

And by "Not Working" I mean the drop down portion is not showing up at all... 所谓“无效”,是指下拉部分根本没有显示...

I finally solved this issue. 我终于解决了这个问题。 The problem was in the CSS like I expected. 问题出在CSS中,正如我预期的那样。 The selectbox dropdown functionality would break do to the "filter:" style tag that provides a gradient for IE. selectbox下拉功能可能会破坏对IE提供渐变的“ filter:”样式标签的作用。 I could have just removed the style tag, but I decided to create a couple conditional comments just in case I found a better fix for this situation in the future (I wanted to keep the "filter:" just in case it was needed later on). 我本可以删除样式标签,但是我决定创建一些条件注释,以防万一我以后找到了更好的解决方案(我想保留“过滤器:”,以防日后需要它时使用) )。

Conditional Comments Used: 使用的条件注释:

    <!--[if lte IE 9]>
      <style type="text/css">
        .sbHolder, .goButtonOne, .goButtonTwo {
           filter: none;
        }
      </style>
    <![endif]-->

    <!--[if lte IE 8]>
     <style type="text/css">
        .sbHolder {
           background:#ccc;
        }
        .goButtonOne, .goButtonTwo {
           background:#bf6c65;
        }
      </style>
    <![endif]-->

The first one gets rid of the filter for IE9 and below. 第一个摆脱了IE9及以下版本的过滤器。 The second one gives a second background color for the browsers that will not have one after getting rid of the filter (IE8 and below) 第二种颜色为浏览器提供了第二种背景颜色,该颜色在摆脱过滤器后将不再具有一种颜色(IE8及更低版本)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM