-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.js
44 lines (38 loc) · 1.04 KB
/
common.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
var slides = document.querySelectorAll('.slider__content .item-slide');
var currentSlide = 0;
function nextSlide(n) {
slides[currentSlide].className = 'item-slide';
currentSlide = (n)%slides.length;
slides[currentSlide].className = 'item-slide showing';
}
var toggle = function(){
var divs = document.querySelectorAll("input.indicator__button");
var handler = function() {
var index = this.getAttribute('data-index');
nextSlide(index);
}
for (var i = 0; i < divs.length; i++) {
divs[i].setAttribute('data-index', i);
divs[i].onclick = handler;
}
}
window.onload= function() {
document.getElementById('toggler').onclick = function() {
openbox('box', this);
return false;
};
};
function openbox(id, toggler) {
var div = document.getElementById(id);
if(div.style.display == 'flex') {
div.style.display = 'none';
myFunction(toggler);
}
else {
div.style.display = 'flex';
myFunction(toggler);
}
}
function myFunction(x) {
x.classList.toggle("change");
}