Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
Latest commit
40 lines (38 loc) · 1.19 KB
/
Copy pathscript.js
File metadata and controls
40 lines (38 loc) · 1.19 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
functionbezier(t){
returnt<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1
}
window.onload=function(){
varnavbar=document.getElementById("navbar");
varelementTarget=document.getElementById("section-2");
varmax1=3.0;
varmax2=6.0;
if(window.scrollY<400){
max1=3.0*bezier(window.scrollY/400.0);
max2=6.0*bezier(window.scrollY/400.0);
max1=max1.toString();
max2=max2.toString();
navbar.style.boxShadow="0 "+max1+"px "+max2+"px 0 #dbdbdb";
}else{
navbar.style.boxShadow="0 3px 6px 0 #dbdbdb";
}
window.addEventListener("scroll",function(){
varnavbar=document.getElementById("navbar");
varelementTarget=document.getElementById("section-2");
varmax1=3.0;
varmax2=6.0;
if(window.scrollY<400){
max1=3.0*bezier(window.scrollY/400.0);
max2=6.0*bezier(window.scrollY/400.0);
max1=max1.toString();
max2=max2.toString();
navbar.style.boxShadow="0 "+max1+"px "+max2+"px 0 #dbdbdb";
}else{
navbar.style.boxShadow="0 3px 6px 0 #dbdbdb";
}
});
}
functiongo_to(id){
$('html,body').animate({
scrollTop: $(id).offset().top},
'slow');
}