Jquery计数器插件

NOCO发布于 分类 Jquery

22天前 有1个用户阅读过

html

<span class="count">2016</span>
jquery
/**
 * Jquery计数器插件
 * seonoco.com
 */
(function ($) {
 $.fn.nocoCount = function (options) {
 var defualts = {
 start: 0,
 end:$(this).text(),
 speed:1000
 };
 var opts = $.extend({}, defualts, options);
 var obj = $(this);

 $(this).each(function () {
 $(this).prop('Counter',opts.start).animate({
 Counter: opts.end
 }, {
 duration: opts.speed,
 easing: 'swing',
 step: function (now) {
  $(this).text(Math.ceil(now));
 }
 });
 });
 }

})(jQuery);

//使用
$('.count').nocoCount();
demo
2016
Run

-- The End --

本文标题: Jquery计数器插件

本文地址: https://seonoco.com/blog/jquery-plugin-counter

本文是否有所帮助?
点赞 0
感谢支持
0
多谢反馈
评论 0
打赏

支持微信/支付宝

评论

网友