-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcnn.js
41 lines (36 loc) · 1.22 KB
/
cnn.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
function scrollRight(){
var container = document.querySelector("#scroll-content");
container.scrollBy({left:100, behavior:'smooth'});
// checkScroll();
}
function scrollToLeft(){
var container = document.querySelector("#scroll-content");
container.scrollBy({left:-100, behavior:'smooth'});
// checkScroll();
}
// function checkScroll(){
// var container = document.querySelector("#scroll-content");
// var leftBtn = document.querySelector("#scroll-btn-left");
// if(container.scrollLeft > 0){
// leftBtn.style.display = display-block;
// }
// else{
// leftBtn.style.display = none;
// }
// }
window.addEventListener('scroll', function(){
var navbar= document.getElementById("navbar");
var bannerHeight = document.getElementById("banner").offsetHeight;
if(window.scrollY > bannerHeight){
navbar.style.position = fixed;
navbar.style.top = 0;
navbar.style.width = '100%';
navbar.style.transform = 'none';
}
else{
navbar.style.position = absolute;
navbar.style.top = 'auto';
navbar.style.left = '50%';
navbar.style.transform = 'translateX(-50%)';
}
});