-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.js
56 lines (45 loc) · 1.15 KB
/
scripts.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
carousel();
const sectionsArray=document.querySelectorAll('section');
const sectionsPos={};
sectionsArray.forEach((section) =>{
sectionsPos[section.id]=section.offsetTop;
});
window.onscroll=() =>{
var scrollPosition= document.documentElement.scrollTop|| document.body.scrollTop;
for(id in sectionPos){
if(sectionsPos[id]<= scrollPosition) {
document,querySelector('.active').classList.remove('active');
document.querySelector('a[href*=${id}]').classList.add('active');
}
}
};
$(function() {
$(document).scroll(function() {
var $nav= $("navbar");
$nav.toggleClass('scrolled', $(this).scrollTop()>$nav.height());
});
});
function send() {
alert("Message Sent");
}
var slideIndex = 1;
showDivs(slideIndex);
function plusDivs(n) {
showDivs(slideIndex += n);
}
function currentDiv(n) {
showDivs(slideIndex = n);
}
var myIndex = 0;
//carousel();
function carousel() {
var i;
var x = document.getElementsByClassName("mySlides");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
myIndex++;
if (myIndex > x.length) {myIndex = 1}
x[myIndex-1].style.display = "block";
setTimeout(carousel, 9000);
}