0

我正在尝试对JQuery Fadein/Fadeout我的网站实施简单。所以我已经完成了这些步骤

查询

<script type="text/javascript">
    $(document).ready(function() {          
    $(".writereview").click(function(){

        $(".reviewpopup").fadeIn();
        $(".popupcontainer").fadeIn();

    });


    $(".popupclose").click(function(){

        $(".reviewpopup").fadeOut();
        $(".popupcontainer").fadeOut();

    });

    });

    </script>

HTML

   <div class="reviewpopup" style="display: none; "></div>
   <div class="popupcontainer" style="display: none; ">
   <iframe src="feedback.html" frameborder="0" scrolling="no" width="475" height="510">               </iframe>
    <a href="#" class="popupclose"><img src="images/popupclose.jpg" alt="HoHo"></a> </div>

CSS

.reviewpopup {

    display:none;
    width:100%;
    height:100%;
    overflow:hidden;
    background-color:#000;
    opacity:0.5;
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; 
    filter: alpha(opacity=50);              
    position:fixed;
    top:0;
    z-index:1001;   
        }

        .popupcontainer {
    width: auto;
    height:auto;
    display:none;
    position:absolute;
    top: 45px;
    left: 50%;
    margin-left: -280px;
    background-color:#FFF;
    z-index:1001;
    border-radius:10px;
    -moz-border-radius:10px;
    -webkit-border-radius:10px;
    border:solid 5px #000;
    padding:20px;
         }

JQuery在所有浏览器中都可以正常工作,但问题是,Opacity is not working properly in IE8. 我刚刚删除了 Jquery,它可以工作。我不知道这个IE8 Opacity和 Jquery 的确切原因是什么。请帮我。

4

1 回答 1

2

fadeIn()覆盖 CSSfilter值,因此当您调用fadeIn部分不透明元素时,您应该在回调中重置该值:

var pop = $('.reviewpopup'),
    filter = pop.css('filter'); // fadeIn overrides filter value in IE8; reset it
pop.fadeIn(function() {
    if (filter) pop.css('filter', filter);
});      
于 2012-10-15T19:04:46.400 回答