【问题标题】:animate repeating in ie7ie7中的动画重复
【发布时间】:2013-02-27 20:48:07
【问题描述】:

如何在 ie7 和 8 中制作 Jquery 连续循环动画? (ie9/chrome 工作正常)

这是我的代码

$(document).ready(function() {
        var $grower = $('#rain'); 

        function runIt() {
            $grower.animate({left:'48%',top:'800px',opacity:'0'}, 1000, function() {
                $grower.removeAttr("style");

                setTimeout(function() {
                    runIt();
                }, 100);
            });
        }

        runIt();
    });

【问题讨论】:

  • 在 IE7/8 中能运行一次,完全没有报错吗?
  • 试试 $grower.css({opacity: 1,left:'auto',top:'auto'});而不是 removeAttr('style')

标签: jquery jquery-animate


【解决方案1】:

我在 IE 8 中试过这个,它对我有用 http://jsfiddle.net/8EtKy/2/

看看吧。

HTML

<div id="rain"></div>

jQuery

$(document).ready(function() {
        var $grower = $('#rain'); 
        function runIt() {
            $grower.animate({left:'48%',top:'800px',opacity:'0'}, 1000, function() {
                $grower.removeAttr("style");

            });
        }
            setInterval(runIt,100);
    });

CSS

#rain{
    width:50px;
    height:50px;
    background-color:#000;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-12-20
    • 2011-12-24
    • 1970-01-01
    • 2023-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多