How can i make infinite loop with timeout function

Gold Pearl

How can i make this counter in infinite loop with timeout function. Here is my code. any help highly appreciated.

JS Fiddle

HTML

<div class="counter inner">
        <ul>
          <li>
              <h5 class="count">35</h5>
              <p>Years</p>
          </li>
          <li>
              <h5 class="count">150</h5>
              <p>Employees</p>
          </li>
        </ul>
    </div>

JS

$('.count').each(function () {
$(this).prop('Counter',0).animate({
    Counter: $(this).text()
}, {
    duration: 2000,
    easing: 'swing',
    step: function (now) {
        $(this).text(Math.ceil(now));
    }
});
});

JS Fiddle

Scimonster

Use a complete callback, reset the counter, and call the animation again.

$('.count').each(function anim() {
$(this).prop('Counter',0).animate({
    Counter: $(this).text()
}, {
    duration: 2000,
    easing: 'swing',
    step: function (now) {
        $(this).text(Math.ceil(now));
    },
    complete: function(){
        $(this).css('counter',0);
        setTimeout(anim.bind(this),1000);
    }
});
});

Fiddle

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How can I iterate through a function with for loop?

분류에서Dev

How can I make a Python function examine every element of a list?

분류에서Dev

How can I make PHP for loop work with $x on changing css background image?

분류에서Dev

How can I make a function run only when I reload the page with angular?

분류에서Dev

Laravel App::make causes infinite loop

분류에서Dev

How do I make variable in for loop bigger that in was

분류에서Dev

How do I make a "for" loop for this sequence of arrays?

분류에서Dev

How can I safely remove timeout from a script?

분류에서Dev

How can I safely remove timeout from a script?

분류에서Dev

How can I change the default website connection timeout in Chrome?

분류에서Dev

Infinite loop while calling function in heightForRowAtIndexPath

분류에서Dev

How can I loop back to the first callback function of jquery load, after a dynamically loaded form is submitted?

분류에서Dev

How can I make this function more modular and be used for multiple members of a struct?

분류에서Dev

How can I make text that looks like a link run a controller function when clicked?

분류에서Dev

How can I break a symbolic link loop?

분류에서Dev

How can I resolve this loop in c#?

분류에서Dev

How can I make IBus not ignore ~/.XCompose?

분류에서Dev

How can i make this css star smaller?

분류에서Dev

How can I make export permanent?

분류에서Dev

How can I make a functioning animated button?

분류에서Dev

How can I make this JButton work

분류에서Dev

How can I make this JButton work

분류에서Dev

How can I make this cases match with regex?

분류에서Dev

How can I partially serialize with GNU make

분류에서Dev

How can I make a certain keyboard shortcut?

분류에서Dev

How can I make Shutter open at startup?

분류에서Dev

Can I apply a function to multiple columns in Pandas dataframe without a for loop?

분류에서Dev

How to test an infinite while loop with pytest

분류에서Dev

How to set Infinite loop slideshow on tumblr header

Related 관련 기사

  1. 1

    How can I iterate through a function with for loop?

  2. 2

    How can I make a Python function examine every element of a list?

  3. 3

    How can I make PHP for loop work with $x on changing css background image?

  4. 4

    How can I make a function run only when I reload the page with angular?

  5. 5

    Laravel App::make causes infinite loop

  6. 6

    How do I make variable in for loop bigger that in was

  7. 7

    How do I make a "for" loop for this sequence of arrays?

  8. 8

    How can I safely remove timeout from a script?

  9. 9

    How can I safely remove timeout from a script?

  10. 10

    How can I change the default website connection timeout in Chrome?

  11. 11

    Infinite loop while calling function in heightForRowAtIndexPath

  12. 12

    How can I loop back to the first callback function of jquery load, after a dynamically loaded form is submitted?

  13. 13

    How can I make this function more modular and be used for multiple members of a struct?

  14. 14

    How can I make text that looks like a link run a controller function when clicked?

  15. 15

    How can I break a symbolic link loop?

  16. 16

    How can I resolve this loop in c#?

  17. 17

    How can I make IBus not ignore ~/.XCompose?

  18. 18

    How can i make this css star smaller?

  19. 19

    How can I make export permanent?

  20. 20

    How can I make a functioning animated button?

  21. 21

    How can I make this JButton work

  22. 22

    How can I make this JButton work

  23. 23

    How can I make this cases match with regex?

  24. 24

    How can I partially serialize with GNU make

  25. 25

    How can I make a certain keyboard shortcut?

  26. 26

    How can I make Shutter open at startup?

  27. 27

    Can I apply a function to multiple columns in Pandas dataframe without a for loop?

  28. 28

    How to test an infinite while loop with pytest

  29. 29

    How to set Infinite loop slideshow on tumblr header

뜨겁다태그

보관