-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
62 lines (51 loc) · 1.77 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
const getDeviceType = () => {
const ua = navigator.userAgent;
if (/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(ua)) {
alert("Use a computer for better UI");
}
if (
/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(
ua
)
) {
alert("Use a computer for better UI");
}
};
getDeviceType();
let btn = document.getElementById("btn");
let bdy = document.getElementById("body");
let hed = document.getElementById("head");
let fot = document.getElementById("foot");
let xnd = document.getElementById("xnd");
let lst = document.getElementsByClassName("lst");
let txt = document.getElementsByClassName("txt");
function exapnd() {
hed.classList.toggle("exp");
xnd.classList.toggle("expbtn");
btn.classList.toggle("btnmv");
Array.from(lst).forEach(Element => {
Element.classList.toggle("expnav");
})
Array.from(txt).forEach(Element => {
Element.classList.toggle("txtvisible");
})
}
function togglebtn() {
btn.classList.toggle("active");
document.getElementById("moon").classList.toggle("bxs-sun");
document.getElementById("logo_img").classList.toggle("logo_img_dark");
document.getElementById("logo_txt").classList.toggle("logo_txt_dark");
document.getElementById("content").classList.toggle("content-light");
Array.from(document.getElementsByClassName("lst")).forEach(Element => {
Element.classList.toggle("lst-light");
})
bdy.classList.toggle("light_body");
hed.classList.toggle("light_hf");
fot.classList.toggle("light_hf");
}
let logotxt = document.getElementById("logo_txt");
scrl.addEventListener('scroll', function(){
var value = scrl.scrollY;
console.log(value);
logotxt.style.left = value *0.5 + 'px';
})