PageSourceSearch

https://www.jlhbedding.com/static/js/countUp.min.js

js jlhbedding.com collected 2026-10-05 00:57:27 UTC 3,301 bytes, 67 lines download raw bytes

1(function($) {
2    $.fn.countTo = function(opts) {
3                // 鍚堝苟鑷畾涔夌殑鏂规硶
4        var options = $.extend({}, $.fn.countTo.defaults, opts);
5
6        return $(this).each(function() {
7                // 璁剧疆鎬绘洿鏂版鏁颁粠鑰屽緱鍒版瘡娆$疮鍔犵殑鍊�
8            var _this = this,
9                originalData = $(this).text(),//鍒濆鍊�
10                loops = Math.ceil(options.speed / options.refreshInterval),//鎬绘洿鏂版鏁�
11                increment = ($(this).text() - options.from) / loops,//姣忔绱姞鐨勫€�
12                loopCount = 0,
13                value = options.from,
14                interval = setInterval(updateTimer, options.refreshInterval);
15            //console.log(Number(originalData).toFixed(options.decimals));
16            function updateTimer() {
17                value += increment;
18                loopCount++;
19                var str=value.toFixed(options.decimals);
20
21                //杩愮畻鍒版鏃剁殑瀛楃涓叉€婚暱搴�
22                this.sizeNum=str.length; 
23
24                //杩愮畻鍒版鏃剁殑灏忔暟鐐瑰墠鐨勫瓧绗﹂暱搴�
25                this.sizeNumBefore=this.sizeNum-options.decimals-1;
26
27                //鍒ゆ柇 姝ゆ椂鐨勫皬鏁扮偣鍓嶇殑瀛楃涓查暱搴︽槸鍚�>=闇€瑕佺殑瀛楃涓插皬鏁扮偣鍓嶇殑闀垮害
28                if(this.sizeNumBefore>=options.beforeSize)  {
29
30               		$(_this).html(str+options.lastSymbol);
31
32                } else{
33                    //鍦�<鐨勬椂鍊� 鍓嶉潰瑕佽ˉ0 鍐嶆樉绀�
34                    this._str = Array(options.beforeSize-this.sizeNumBefore + 1).join('0') + str;
35                	$(_this).html(this._str+options.lastSymbol);
36                }          
37
38
39                if (typeof(options.onUpdate) == 'function') {
40                    options.onUpdate.call(_this, value, loopCount);
41                    //鐢╟all鏂规硶 鎶� options.onUndate=='function'(鏄竴涓柟娉�), 鏇挎崲鎺塤this锛屽苟鎶妚alue浣滀负鍜岃繖涓嚱鏁扮殑鍙傛暟   
42                }
43                if (loopCount >= loops) {//over
44                    clearInterval(interval);
45                    $(_this).html(originalData+options.lastSymbol);
46                    value = $(_this).text();
47
48                    if (typeof(options.onComplete) == 'function') {
49                        //options.onComplete.call(_this, value, loopCount);
50                        options.onComplete(value,loopCount,_this);
51                    }
52                }
53            }
54        });
55    };
56
57    $.fn.countTo.defaults = {
58    	lastSymbol:"%", //鏄剧ず鍦ㄦ渶鍚庣殑瀛楃
59        from: 0,  // 寮€濮嬫椂鐨勬暟瀛�
60        speed: 1000,  // 鎬绘椂闂�
61        refreshInterval: 100,  // 鍒锋柊涓€娆$殑鏃堕棿
62        beforeSize:0, //灏忔暟鐐瑰墠鏈€灏忔樉绀轰綅鏁帮紝涓嶈冻鐨勮瘽鐢�0浠f浛
63        decimals: 0,  // 灏忔暟鐐瑰悗鐨勪綅鏁�
64        onUpdate: null,  // 鏇存柊鏃跺洖璋冨嚱鏁�
65        onComplete: null  // 缁撴潫鍚庡洖璋冨嚱鏁�
66    };
67})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.