Jquery – CSS – IE7 & 8 Issues

cssinternet-explorer-7jquery

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);
}

Best Answer

This should fix it...

#mainNav {
  zoom:1;
}

Read more about the concept of hasLayout in IE