-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
51 lines (46 loc) · 1.19 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var formatThousandsNoRounding = function (n, dp) {
var e = "",
s = e + n,
l = s.length,
b = n < 0 ? 1 : 0,
i = s.lastIndexOf(","),
j = i == -1 ? l : i,
r = e,
d = s.substr(j + 1, dp);
while ((j -= 3) > b) {
r = "." + s.substr(j, 3) + r;
}
return (
s.substr(0, j + 3) +
r +
(dp ? "," + d + (d.length < dp ? "00000".substr(0, dp - d.length) : e) : e)
);
};
var hasRun = false;
inView("#countUp").on("enter", function () {
if (hasRun == false) {
$(".number").each(function () {
var $this = $(this),
countTo = $this.attr("data-count");
$({ countNum: $this.text() }).animate(
{
countNum: countTo,
},
{
duration: 2000,
easing: "linear",
step: function () {
$this.text(formatThousandsNoRounding(Math.floor(this.countNum)));
},
complete: function () {
$this.text(formatThousandsNoRounding(this.countNum));
},
}
);
});
hasRun = true;
}
});
// window.open("https://amzn.to/3jujImr","_self");
// window.open("https://abhi3566.github.io/#community", "_blank");
// This website is made by Abhishek Kashyap