-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathscript.js
More file actions
51 lines (44 loc) · 1.3 KB
/
script.js
File metadata and controls
51 lines (44 loc) · 1.3 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
$(document).ready(function () {
var scrollPosCheck;
/* load Discord invite link from invite.txt */
$.get('invite.txt', function (data) {
$(".modal").append(
'<a href="' + data + '" class="modal-link button cyan">join</a>'
);
});
/* open modal */
$('#join-button').click(function () {
$('.modal-container').addClass("modal-container-show");
$('html,body').css({ "overflow": "hidden" });
});
/* close modal */
$('.modal-container').click(function (e) {
if (e.target !== e.currentTarget) return;
$('.modal-container').removeClass("modal-container-show");
$('html,body').css({ "overflow": "visible" });
});
$(window).scroll(function () {
clearTimeout(scrollPosCheck);
checkScrollPosition();
});
function checkScrollPosition() {
scrollPosCheck = setTimeout(function () {
if ($(window).scrollTop() > 200) {
$('nav').addClass("scrolled");
} else {
$('nav').removeClass("scrolled");
}
}, 100)
};
$('nav').children('img').click(function () {
$('html, body').animate({ scrollTop: 0 }, 500);
})
$('#twismile').click(function () {
if (!($(this).hasClass("slide"))) {
$('#twismile').addClass("slide");
setTimeout(function () {
$('#twismile').removeClass("slide");
}, 4000);
}
});
});