-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
66 lines (54 loc) · 1.47 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
52
53
54
55
56
57
58
59
60
61
62
63
64
$(document).ready(function () {
const o = $('.nav').outerHeight(true)/2;
$(".home").click(function(e) {
e.preventDefault();
$('html,body').animate({
scrollTop: 0
}, 800);
clearOverlay();
});
$(".about").click(function(e) {
e.preventDefault();
$('html,body').animate({
scrollTop: $("#a").offset().top - o
}, 800);
clearOverlay();
});
$(".project").click(function(e) {
e.preventDefault();
$('html,body').animate({
scrollTop: $("#b").offset().top - o
}, 800);
clearOverlay();
});
$(".exp").click(function(e) {
e.preventDefault();
$('html,body').animate({
scrollTop: $("#c").offset().top - o
}, 800);
clearOverlay();
});
$(".art").click(function(e) {
e.preventDefault();
$('html,body').animate({
scrollTop: $("#d").offset().top - o
}, 800);
clearOverlay();
});
function clearOverlay(e) {
const menu = document.getElementById("toggle");
const overlay = document.getElementById("overlay");
const bod = document.getElementById("body");
menu.classList.remove("open");
overlay.classList.remove("open");
bod.classList.remove("scrollless");
}
});
function openNav(e) {
const menu = document.getElementById("toggle");
const overlay = document.getElementById("overlay");
const bod = document.getElementById("body");
menu.classList.toggle("open");
overlay.classList.toggle("open");
bod.classList.toggle("scrollless");
}