本文介绍了CSS - IE7& 8个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UPDATE



我注意到这种情况只发生在我使用slideUp / down.If我使用show / hide everythings OK



END UPDATE



在我的网站中,我正在开发/设计, / p>

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





在IE8中,菜单向上滑动后,边缘似乎被删除。 / p>



JS(如果需要)

 
$(function(){
$(#mainNav li:has(ul)> a)。addClass(hasMore);
$ #mainNav li)。hoverIntent(menuOn,menuOff);
$ .each($(#mainNav a.active)。parents(li),function(){
$ ).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))。
$(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 !重要;
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);
}


解决方案


$ b

  #mainNav {
zoom:1;
}

详细了解中hasLayout的概念


UPDATE

I noticed this occurs only when I use slideUp/Down.If I use show/hide everythings OK

END UPDATE

In my site I am developing/designing, I have 2 issues.

In IE7, the sliding menu seems to not show, until I move the mouse abit.

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

In IE8, after a menu slides up, the margin seems to be removed.

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

The JS (if required)

$(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() {

}

The 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);
}
解决方案

This should fix it...

#mainNav {
  zoom:1;
}

Read more about the concept of hasLayout in IE

这篇关于CSS - IE7& 8个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 15:01