質問編集履歴
2
間違えてい変数の綴りを修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,9 +28,13 @@
|
|
28
28
|
|
29
29
|
```javascript
|
30
30
|
|
31
|
-
var JSCODE = JSCODE || {};
|
32
31
|
|
32
|
+
|
33
|
+
$(function(){
|
34
|
+
|
33
|
-
JSCODE.COUNT
|
35
|
+
new JSCODE.COUNT.CountUp(this);
|
36
|
+
|
37
|
+
});
|
34
38
|
|
35
39
|
|
36
40
|
|
@@ -64,7 +68,7 @@
|
|
64
68
|
|
65
69
|
bindEvent: function(){
|
66
70
|
|
67
|
-
|
71
|
+
self = this;
|
68
72
|
|
69
73
|
this.countEvent();
|
70
74
|
|
@@ -122,12 +126,6 @@
|
|
122
126
|
|
123
127
|
|
124
128
|
|
125
|
-
$(function(){
|
126
|
-
|
127
|
-
new JSCODE.COUNT.CountUp(this);
|
128
|
-
|
129
|
-
});
|
130
|
-
|
131
129
|
|
132
130
|
|
133
131
|
|
1
const追記、selfを修正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,15 +28,31 @@
|
|
28
28
|
|
29
29
|
```javascript
|
30
30
|
|
31
|
+
var JSCODE = JSCODE || {};
|
32
|
+
|
33
|
+
JSCODE.COUNT = JSCODE.COUNT || {};
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
JSCODE.COUNT.CountUp = function(ele) {
|
38
|
+
|
39
|
+
this.$target = $(ele);
|
40
|
+
|
41
|
+
this.init();
|
42
|
+
|
43
|
+
};
|
44
|
+
|
45
|
+
|
46
|
+
|
31
|
-
SCODE.COUNT.CountUp.prototype = {
|
47
|
+
JSCODE.COUNT.CountUp.prototype = {
|
32
48
|
|
33
49
|
|
34
50
|
|
35
51
|
init: function(){
|
36
52
|
|
37
|
-
COUNT_MAX = 178
|
53
|
+
COUNT_MAX = 123456789; //カウント上限
|
38
54
|
|
39
|
-
SPEED =
|
55
|
+
SPEED = 999; //カウントアップの速度
|
40
56
|
|
41
57
|
this.$countUp = this.$target.find('#countBox');
|
42
58
|
|
@@ -48,7 +64,7 @@
|
|
48
64
|
|
49
65
|
bindEvent: function(){
|
50
66
|
|
51
|
-
self = this;
|
67
|
+
_self = this;
|
52
68
|
|
53
69
|
this.countEvent();
|
54
70
|
|
@@ -72,13 +88,13 @@
|
|
72
88
|
|
73
89
|
if(randamNum >= COUNT_MAX){//止める処理
|
74
90
|
|
75
|
-
self.$countUp.text(self.shapingNum(String(COUNT_MAX)));
|
91
|
+
_self.$countUp.text(_self.shapingNum(String(COUNT_MAX)));
|
76
92
|
|
77
93
|
clearInterval(jsCountUp);
|
78
94
|
|
79
95
|
}else{
|
80
96
|
|
81
|
-
self.$countUp.text(self.shapingNum(countText));
|
97
|
+
_self.$countUp.text(_self.shapingNum(countText));
|
82
98
|
|
83
99
|
}
|
84
100
|
|
@@ -104,4 +120,18 @@
|
|
104
120
|
|
105
121
|
};
|
106
122
|
|
123
|
+
|
124
|
+
|
125
|
+
$(function(){
|
126
|
+
|
127
|
+
new JSCODE.COUNT.CountUp(this);
|
128
|
+
|
129
|
+
});
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
107
137
|
```
|