-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
executable file
·128 lines (93 loc) · 2.91 KB
/
script.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// DARK MODE TOGGLE
let btn = document.querySelector(".darkmode");
btn.addEventListener("click", () => {
if (btn.innerHTML === `<i class="fas fa-moon"></i>`) {
btn.innerHTML = `<i class="fas fa-sun"></i>`;
btn.style.color = "white";
btn.style.backgroundColor = "transparent";
document.body.classList.add("darkmode");
} else {
btn.innerHTML = `<i class="fas fa-moon"></i>`;
btn.style.color = "black";
btn.style.backgroundColor = "transparent";
document.body.classList.remove("darkmode");
}
});
// PROJECTS GALLERY SLIDES
let slideIndex = 1;
showDivs(slideIndex);
function plusDivs(n) {
showDivs(slideIndex += n);
}
function currentDiv(n) {
showDivs(slideIndex = n);
}
function showDivs(n) {
var i;
var x = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("demo"); // display navigation buttons at bottom of project images
if (n > x.length) {slideIndex = 1}
if (n < 1) {slideIndex = x.length}
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" w3-gray", "");
}
x[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " w3-gray";
}
// another project gallery
let slideIndex1 = 1;
showDivs1(slideIndex1);
function plusDivs1(n) {
showDivs1(slideIndex1 += n);
}
function currentDiv1(n) {
showDivs1(slideIndex1 = n);
}
function showDivs1(n) {
var i;
var x = document.getElementsByClassName("mySlides1");
var dots = document.getElementsByClassName("demo1"); // display navigation buttons at bottom of project images
if (n > x.length) {slideIndex1 = 1}
if (n < 1) {slideIndex1 = x.length}
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" w3-gray", "");
}
x[slideIndex1-1].style.display = "block";
dots[slideIndex1-1].className += " w3-gray";
}
/* `see more` feature*/
function myFunction() {
var dots = document.getElementById("dots");
var moreText = document.getElementById("more");
var btnText = document.getElementById("myBtn");
if (dots.style.display === "none") {
dots.style.display = "inline";
btnText.innerHTML = "Show more";
moreText.style.display = "none";
} else {
dots.style.display = "none";
btnText.innerHTML = "Show less";
moreText.style.display = "inline";
}
}
/* another `see more` */
function myFunction1() {
var dots = document.getElementById("dots1");
var moreText = document.getElementById("more1");
var btnText = document.getElementById("myBtn1");
if (dots.style.display === "none") {
dots.style.display = "inline";
btnText.innerHTML = "Show more";
moreText.style.display = "none";
} else {
dots.style.display = "none";
btnText.innerHTML = "Show less";
moreText.style.display = "inline";
}
}