Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
69 lines (56 loc) · 1.54 KB
/
Copy pathscript.js
File metadata and controls
69 lines (56 loc) · 1.54 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
var a = 0;
$(window).scroll(function() {
var oTop = $('.counter').offset().top - window.innerHeight;
if (a == 0 && $(window).scrollTop() > oTop) {
$('.counter-value').each(function() {
var $this = $(this),
countTo = $this.attr('data-count');
$({
countNum: $this.text()
}).animate({
countNum: countTo
},
{
duration: 4000,
easing: 'swing',
step: function() {
$this.text(Math.floor(this.countNum));
},
complete: function() {
$this.text(this.countNum);
//alert('finished');
}
});
});
a = 1;
}
});
const faders = document.querySelectorAll(".fade-in");
const sliders = document.querySelectorAll(".slide-in");
const appearOptions = {
threshold: 0,
rootMargin: "0px 0px -250px 0px",
};
const appearonScroll = new IntersectionObserver(function (
entries,
appearonScroll
) {
entries.forEach((entry) => {
if (!entry.isIntersecting) {
return;
} else {
entry.target.classList.add("appear");
appearonScroll.unobserve(entry.target);
}
});
},
appearOptions);
faders.forEach((fader) => {
appearonScroll.observe(fader);
});
sliders.forEach((fader) => {
appearonScroll.observe(fader);
});
sliders.forEach((slider) => {
appearonScroll.observe(slider);
});