-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
38 lines (34 loc) · 1.17 KB
/
main.js
File metadata and controls
38 lines (34 loc) · 1.17 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
//When user scroll
window.onscroll = function(){
scrollFunction()
};
function scrollFunction(){
if(document.body.scrollTop > 10 || document.documentElement.scrollTop > 10){
document.getElementById("navigation").classList.add("white-bg");
document.getElementById("navigation").style.color = '#000';
for(var i = 0; i < document.getElementsByClassName("nav-link").length; i++){
document.getElementsByClassName("nav-link")[i].style.color = '#000';
document.getElementsByClassName("nav-link")[i].style.opacity = '0.7';
}
} else {
document.getElementById("navigation").classList.remove("white-bg");
document.getElementById("navigation").style.color = '#fff';
for(var i = 0; i < document.getElementsByClassName("nav-link").length; i++){
document.getElementsByClassName("nav-link")[i].style.color = '#fff';
document.getElementsByClassName("nav-link")[i].style.opacity = '1';
}
}
}
var main = function(){
$('.icon-menu').click(function(){
$('.menu').animate({
right: '0px'
}, 200);
});
$('.icon-close').click(function(){
$('.menu').animate({
right: '-250px'
}, 200);
});
};
$(document).ready(main);