How can I loop an animation continuously in jQuery?

前端 未结 9 1218
长情又很酷
长情又很酷 2020-12-01 14:52

I need to know how to infinitely loop this animation. It is a text scroll animation and I need it to repeat after it\'s finished.

Here is the jQuery:



        
相关标签:
9条回答
  • 2020-12-01 15:26
    yourloop = setInterval(function() {
      // tasks
    }, timeInMilliseconds );
    

    Enjoy!

    0 讨论(0)
  • 2020-12-01 15:27

    probably the simplest solution.

    var movement1 = function(speed){
      $(".mydiv").animate({"top": "100px"}, speed,function(){
          movement2(speed)
      });
    }
    
    
    var movement2 = function(speed){
      $(".mydiv").animate({"top": "120px"}, speed,function(){
          movement1(speed)
      });
    }
    
      movement1(1000);
    

    this is eventually call each other infinitely.

    0 讨论(0)
  • 2020-12-01 15:27

    Like this:

    <script>
    $(document).ready(function()
    {
        $(window).load(function()
        {
            var a="#bijin"
            var x=1000
            var y=1000
    
            for (var i=1 ; i<=100000 ; i++){
                $(a).slideUp(x).slideDown(y);  
            }
        });
    });
    
    </script>
    

    Example: http://www.hpcreating.com/effect/jquery2/slide4.html

    0 讨论(0)
提交回复
热议问题