CSS - IE7& 8个问题

时间:2009-07-28 15:13:28

标签: jquery css internet-explorer-7

更新

我注意到只有当我使用slideUp / Down时才会出现这种情况。如果我使用show / hide everythings OK

END UPDATE

在我的网站上我正在开发/设计,我有2个问题。

在IE7中,滑动菜单似乎没有显示,直到我移动鼠标abit。

alt text http://img27.imageshack.us/img27/4422/7282009105215pm.png

在IE8中,菜单向上滑动后,边距似乎已被删除。

alt text http://img27.imageshack.us/img27/4592/7282009105247pm.png

JS(如果需要)

$(function() {
    $("#mainNav li:has(ul) > a").addClass("hasMore");
    $("#mainNav li").hoverIntent(menuOn, menuOff);
    $.each($("#mainNav a.active").parents("li"), function() {
        $(this).children("a:first").addClass("active");
    });
    $("#mainNav").mouseleave(function() {
        $("ul", this).slideUp(200);
        $(".open", this).removeClass("open");
    });
});
function menuOn() {
    var childUl = $(this).children("ul");
    if (childUl.length) {
        childUl.slideDown(200);
        $(this).addClass("open");

        $("ul", $(this).closest("li").siblings("li")).slideUp(200);
        $(this).closest("li").siblings("li").removeClass("open");
    }
}
function menuOff() {

}

CSS

#mainNav, #mainNav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
#mainNav ul {
    display: none;
}
#mainNav li {
    position: relative;
}
#mainNav li ul {
    margin: 2px 0 2px 5px;
    background-color: #282a33;
}
#mainNav a:link, #mainNav a:visited {
    display: block;
    padding: 5px 10px;
    margin-bottom: 2px;
    color: #282a33;
    background-color: #ffe7a6;
    text-decoration: none;
}
#mainNav a:hover, #mainNav a:active {
    background-color: #e6c468;
}
#mainNav > li.open > a.hasMore {
    background-color: #e6c468;
}
#mainNav > li > a.active {
    color: #fff;
    background-color: #fa8000 !important;
    font-weight: bold;
}
#mainNav li li a:link, #mainNav li li a:active, #mainNav li li a:visited, #mainNav li li a:hover {
    background-color: transparent !important;
    padding: 2px 5px;
    font-family: Georgia, Garamond, "Times New Roman", serif;
    font-size: 11px;
    font-weight: bold;
    color: white;
}
#mainNav li li a:hover, #mainNav li li a:active {
    color: #ffe7a6;
}
#mainNav li li a.active {
    color: #fa8000;
}
#mainNav a.hasMore {
    background-image: url(../images/section_collapsed.png);
    background-repeat: no-repeat;
    background-position: right center;
}
#mainNav a.active.hasMore,
#mainNav a.hasMore:hover,
#mainNav li li > a.hasMore {
    background-image: url(../images/section_collapsed2.png);
}
#mainNav li.open > a.active.hasMore,
#mainNav li.open > a.hasMore {
    background-image: url(../images/section_expanded2.png);
}

1 个答案:

答案 0 :(得分:0)

这应该解决它......

#mainNav {
  zoom:1;
}

详细了解concept of hasLayout in IE