【问题标题】:JQuery/css dropdown menu not visible in Internet Explorer 9JQuery/css 下拉菜单在 Internet Explorer 9 中不可见
【发布时间】:2012-07-31 05:53:12
【问题描述】:

我的下拉菜单在除 IE 之外的所有浏览器中都能正常工作。我可以看到在开发人员工具中触发了悬停功能,但由于某种原因,菜单实际上并不可见。我已经以我能想到的所有方式调整了 CSS……有什么我忽略的吗?

网站是:http://www.ironbridgeband.com

音乐会自动播放(不是我的选择),因此请注意您的音量 根据开发者工具,IE9 是浏览器模式。

编辑:这是使用的 CSS 和 JQuery:

    /* 
    LEVEL ONE
*/
#navigation > ul                         {text-align: center; position: relative;}
#navigation > ul li{
float: left;
background: transparent;
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#00990000,endColorstr=#00990000); 
zoom: 1;
z-index: 0;
}
#navigation > ul a:hover                 {color: #000;}
#navigation > ul a:active                {color: #fff;}
#navigation > ul li a                    {display: block;}
#navigation > ul li.hover,
#navigation > ul li:hover                {color: #fff; position: relative; }
#navigation > ul li.hover a              {color: #FFF;}


/* 
    LEVEL TWO
*/
ul.children{
    list-style-type: none;
    font-size: 0.8em;
    width: 100%;
    visibility: hidden;
    position: absolute;
    top: 50px;
    z-index: 500;
    margin-left: 0px !important;
    padding-left: 0px !important;
    line-height:2em;
    background: transparent !important;
    }

ul.children li{
    font-size: 16px;
    text-transform: none;
    font-weight: normal;
    float: none !important;
    clear: both;
    font-weight: bold; 
    background: #158082;
    color: #fff; 
    border: none; 
    float: none; 
    margin-left: -25px !important;
    padding: 0 !important;
    z-index: 501;
    }

ul.children li.hover{
    background-color: transparent !important;
    }                                     
                                    /* IE 6 & 7 Needs Inline Block */
ul.children li a{ 
    border-right: none; 
    display: inline-block;
    width:auto;
    } 

*JQuery: *

$(function(){

    var config = {    
         sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)    
         interval: 100,  // number = milliseconds for onMouseOver polling interval    
         over: doOpen,   // function = onMouseOver callback (REQUIRED)    
         timeout: 200,   // number = milliseconds delay before onMouseOut    
         out: doClose    // function = onMouseOut callback (REQUIRED)    
    };

    function doOpen() {
        console.log("doOpen()")
        $(this).addClass("hover");
        $('ul:first',this).css('visibility', 'visible');
        $('ul:first',this).css('z-index', '100001');
    }

    function doClose() {
        console.log("doClose()")
        $(this).removeClass("hover");
        $('ul:first',this).css('visibility', 'hidden');
    }

    $("#navigation > ul li").hoverIntent(config);

    $("#navigation > ul li ul li:has(ul)").find("a:first").append(" » ");

});

【问题讨论】:

  • 能否请您发布相关代码的 sn-p?另外,您能否打开 IE,按 F12(打开开发者工具)并告诉我们您的 “浏览器模式” 设置为什么?

标签: jquery css internet-explorer


【解决方案1】:

尝试为您的#navigation 元素设置比下拉菜单更高的 z-index。

【讨论】:

    猜你喜欢
    • 2012-10-02
    • 1970-01-01
    • 2011-04-04
    • 1970-01-01
    • 1970-01-01
    • 2012-07-22
    • 1970-01-01
    • 2017-05-19
    • 1970-01-01
    相关资源
    最近更新 更多