开发者

fadeIn doesn't work in IE9

开发者 https://www.devze.com 2023-03-23 20:07 出处:网络
It\'s the simplest think on earth but it doesn\'t work!! fadeIn function doesn\'t work in IE9? here is a demo: http://sergejpopov.com/test.htm

It's the simplest think on earth but it doesn't work!! fadeIn function doesn't work in IE9? here is a demo: http://sergejpopov.com/test.htm

Any ideas? I found this: http://www.kevinleary.net/wp-samples/ie-fade-problems.php but couldn't figure out how they fixed it.

JS:

$(document).ready(function () {
            $(".a").click(function () {
                $(".b").fadeIn("500");
            });
        });

HTML:

<style type="text/css">
   .b{ dis开发者_StackOverflow中文版play:none; background-color:#fff;}
</style>


<a href="javascript:void(0);" class="a" >aaa</a>
    <p class="b">bbb</p>

EDIT:

weird but fadeOut is working without any issues..


Ok so what i have figured out is that it breaks in IE9 if the display property set to none; and the only way to make it work is instead of setting display:none; to hide(); it on page load..

  $(document).ready(function () {
            $(".b").hide();
            $(".a").click(function () {
                $(".b").fadeIn(500);
                return false;
            });
            $(".c").click(function () {
                $(".d").fadeOut(500);
                return false;
            });
        });


The duration should be an integer, try this

$(document).ready(function () {
            $(".a").click(function () {
                $(".b").fadeIn(500);
            });
        });


$(document).ready(function () {
    $(".a").click(function () {
        $(".b").fadeIn(500);

        return false;
    });
});

<a href="#" class="a" >aaa</a>
<p class="b">bbb</p>
0

精彩评论

暂无评论...
验证码 换一张
取 消