javascript - Text animation from left and right in continuous loop using jquery - Stack Overflow

I want to animate text smoothly from left and right in continuous loop can anyone suggest me something

I want to animate text smoothly from left and right in continuous loop can anyone suggest me something here is the fiddle link: /

 $(document).ready(function () {
    $('.kp').animate({
        left: '10px'
    }, 600);
    $('.kp').delay(600).animate({
        left: '-128px'
    }, 600);
    $('.rp').delay(2000).animate({
        left: '10px'
    }, 600);
    $('.rp').delay(600).animate({
        left: '-108px'
    }, 600);
    $('.kpp').delay(4000).animate({
        left: '10px'
    }, 600);
});

I want to animate text smoothly from left and right in continuous loop can anyone suggest me something here is the fiddle link: http://jsfiddle/yLNGn/3/

 $(document).ready(function () {
    $('.kp').animate({
        left: '10px'
    }, 600);
    $('.kp').delay(600).animate({
        left: '-128px'
    }, 600);
    $('.rp').delay(2000).animate({
        left: '10px'
    }, 600);
    $('.rp').delay(600).animate({
        left: '-108px'
    }, 600);
    $('.kpp').delay(4000).animate({
        left: '10px'
    }, 600);
});
Share Improve this question edited Aug 31, 2013 at 8:47 Vignesh Pichamani 8,07022 gold badges80 silver badges117 bronze badges asked Aug 31, 2013 at 8:04 RonakRonak 412 silver badges7 bronze badges 1
  • So you want to run the sequence you've posted above and then re-start that sequence so that it continues to run in perpetuity? Or is there another aspect to your question? – David Thomas Commented Aug 31, 2013 at 8:47
Add a ment  | 

3 Answers 3

Reset to default 1

See Here is the answer. I make it as the seperate function with fiddle see here.

function repeat() {
    $('.kp').animate({
    left: '10px'
}, 600);
$('.kp').delay(600).animate({
    left: '-128px'
}, 600);
$('.rp').delay(2000).animate({
    left: '10px'
}, 600);
$('.rp').delay(600).animate({
    left: '-108px'
}, 600);
$('.kpp').delay(4000).animate({
    left: '10px'
}, 600);
    $('.kpp').delay(600).animate({
        left:'-108px'
   },600 ,function() {
        repeat();
    });
}

Fiddle

Hopefully it may helps.

Well, you can use setInterval function, or if you make use of the plete callback of the jquery animate method:

$(document).ready(function () {
  console.log('ready');

  var james = $('#bond');

  var right = function () {
    james.animate({left: '100px'}, 600, left);
  };

  var left = function () {
    james.animate({left: '0px'}, 600, right);
  };

  right();
});

this is the plete fiddle example: http://jsfiddle/yLNGn/32/

Have you considered using this jQuery plugin?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745663497a4638980.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信