Play Google

玩转谷歌--学习笔记,成长历程。

« JS也疯狂(3)-- 重载

IE6下拉列表框BUG 解决方案

 

IE6有很多奇快的BUG ,下拉列表框总是在其他元素上面就是其中一个。

但是IE6有一个奇快的逻辑,div 无法覆盖select,但是iframe 可以覆盖select。而div可以覆盖iframe。

这里就是用div的这个逻辑来解决这个问题。

在弹出层时,插入一个iframe,使其的大小、位置和弹出的层一模一样,但是,其z-index属性小于div,即可解决这个问题。

   //一下代码基于Jquery

  //首先判断是否IE6,如果是IE6,则添加一个隐藏的iframe

//在CSS中IFRAME 的样式为

        iframe#frameBg{border:0;background:none; width:230px;position:absolute;display:none;z-index:1;}


            if(navigator.userAgent.indexOf("MSIE 6.0")>-1)
            {
                 $("body").append("<iframe id='frameBg'></iframe>");
            }

//在点击按钮弹出层时,设置IFRAME 和弹出层popCompanyList 的样式打下和位置一样。

 $(".quickChange").click(function(){
                $(".popCompanyList").toggle();
                $("#frameBg").toggle();
                $("#frameBg").css("left",$(".popCompanyList").css("left"));
                $("#frameBg").css("top",$(".popCompanyList").css("top"));
                $("#frameBg").css("height",$(".popCompanyList").height());
            });

 

 

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

vinehoo,web2.0葡萄酒社区
vinehoo,web2.0葡萄酒社区

日历

最新评论及回复

最近发表

Powered By Karry 

Copyright © 2008 PlayGoogle.com. All Rights Reserved.