增加单个元素JQUERY的计数器

时间:2017-02-25 18:06:27

标签: jquery

我找到了一个自动增量计数器的脚本,它有更多的元素。

我想为一个元素制作它。它使用.each而我不需要 - 如何删除每个?



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

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="shiva"><span class="counter">200</span></div>
&#13;
&#13;
&#13;

0 个答案:

没有答案