我的页面布局在IE7打破,权利本身,如果我悬停/打开菜单项 [英] My page layout breaks in IE7, rights itself if I hover over/open a menu item

查看:114
本文介绍了我的页面布局在IE7打破,权利本身,如果我悬停/打开菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如你可以看到,如果你去IE7 / AOL下面的链接,如果你调整窗口大小,布局打破。但是,单击产品菜单选项卡,其权限本身。我没有一个线索为什么或如何解决它,它看起来马虎。在调整页面大小时,标志和面包屑轨迹div留在他们应该在哪里,但我的水平导航菜单和面包屑div下面的所有的东西最终大约20-30像素向右。

As you can see if you go to the link below in IE7/AOL, the layout breaks if you resize the window. However, click the products menu tab and it rights itself. I haven't a clue why or how to fix it, and it looks sloppy. On resizing the page, the logo and breadcrumb trail div stay where they ought to be, but my horizontal nav menu and everything below the breadcrumb div end up about 20-30 pixels off to the right. On refreshing the page, changing page, or opening a pull down menu item, it all falls back into the correct alignment.

链接文本

推荐答案

)divs,在悬停在别的东西,鼠标移开或任何其他奇怪的事件后,使用下面的jQuery更正自己:

To fix incorrectly rendered (in ie7) divs, which correct themselves after hovering over something else, mousing out, or any other weird event, use the below jQuery:

    if ($("html").hasClass("ie7")){
        var tempHolder = $("#ajaxresults").html();
        $("#ajaxresults").html(tempHolder);
    }

逻辑很简单,我想你可以做很容易与javascript的innerHTML。

The logic is pretty simple, and I'm imagine you could do it just as easily with javascript's "innerHTML". Just rewrite the html contents of the div that's misbehaving, and this'll cause it to recompute the styles.

对于给html或body标签的ie7类,我只是重写了div的html内容行为不正确,这将导致它重新计算样式。推荐看看html5boilerplate.com。如果由于某些原因你不能使用他们的解决方案,它的jquery是:

As for giving the html or body tag the ie7 class, I recommend taking a look at html5boilerplate.com. If for some reason you can't use their solution, the jquery for it is:

    if ($.browser.msie){
        if ($.browser.version < 8){
            $("html").addClass("ie ie7");
        }
        else {
            $("html").addClass("ie");
        }
    }

这篇关于我的页面布局在IE7打破,权利本身,如果我悬停/打开菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆