forked from AM1CODES/Poke-Dex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
35 lines (28 loc) · 1.09 KB
/
main.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
const setNormalView = (isNormalView) => {
if (isNormalView) {
document.querySelector('#normal-view').classList.add('selected');
document.querySelector('#compact-view').classList.remove('selected');
document.querySelectorAll('.card-body').forEach((cardBody) => {
cardBody.classList.remove('hidden');
});
document.querySelectorAll('.row>div').forEach(ele => {
ele.classList.replace('col-lg-2', 'col-lg-4');
});
} else {
document.querySelector('#compact-view').classList.add('selected');
document.querySelector('#normal-view').classList.remove('selected');
document.querySelectorAll('.card-body').forEach((cardBody) => {
cardBody.classList.add('hidden');
});
document.querySelectorAll('.row>div').forEach(ele => {
ele.classList.replace('col-lg-4', 'col-lg-2');
});
}
};
setNormalView(true); // By default normal view is enabled.
document.querySelector('#normal-view').addEventListener('mousedown', () => {
setNormalView(true);
});
document.querySelector('#compact-view').addEventListener('mousedown', () => {
setNormalView(false);
});