-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.js
63 lines (54 loc) · 2.01 KB
/
main.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
52
53
54
55
56
57
58
59
60
61
62
63
AOS.init({ duration: 600, anchorPlacement: "center-bottom" });
const navLinks = document.querySelectorAll('.nav-item')
const menuToggle = document.getElementById('navbarNav')
const bsCollapse = new bootstrap.Collapse(menuToggle, {toggle:false})
navLinks.forEach((l) => {
l.addEventListener('click', () => { bsCollapse.toggle() })
})
$(window).scroll(testScroll);
var viewed = false;
function isScrolledIntoView(elem) {
var docViewTop = $(window).scrollTop();
var docViewBottom = docViewTop + $(window).height();
var elemTop = $(elem).offset().top;
var elemBottom = elemTop + $(elem).height();
return elemBottom <= docViewBottom && elemTop >= docViewTop;
}
function testScroll() {
if (isScrolledIntoView($(".milestone-number")) && !viewed) {
viewed = true;
$(".number-holder").each(function () {
$(this)
.prop("Counter", 0)
.animate(
{
Counter: $(this).text(),
},
{
duration: 4000,
easing: "swing",
step: function (now) {
$(this).text(Math.ceil(now));
},
}
);
});
}
}
$(window).on("load", function () {
if(document.createStyleSheet) {
//@import url("https://codepen.io/DXC/pen/6e5e17a21aa0f1f0df762d0c800aee8b.css");
document.createStyleSheet("https://codepen.io/DXC/pen/6e5e17a21aa0f1f0df762d0c800aee8b.css")
}
else {
$("head").append($("<link rel='stylesheet' href='https://codepen.io/DXC/pen/6e5e17a21aa0f1f0df762d0c800aee8b.css' type='text/css' media='screen' />"));
}
$(".last-rs").next().hide();
})
// $(".active-now").next().slideToggle();
// $(".row4").next().slideToggle();
// $(".member-title").click(function(e) {
// console.log("Clicked");
// $(this).next().slideToggle();
// $(this).next().next().next().slideToggle();
// })