blob: b3177bcf09e60e063d5c69fd5021fd3cf84187fb (
plain)
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
|
'use strict';
window.addEventListener('scroll', () => {
const articles = document.getElementsByTagName('article');
const header = document.getElementById('side-bar');
if (window.pageYOffset >= 500) {
if (header && !header.classList.contains('hidden')) {
header.classList.add('hidden');
if (articles) {
[...articles].forEach(e => {
e.classList.add('zen-mode');
});
}
}
} else if (header && header.classList.contains('hidden')) {
header.classList.remove('hidden');
if (articles) {
[...articles].forEach(e => {
e.classList.remove('zen-mode');
e.classList.add('zen-mode-disabling');
});
setTimeout(function() {
[...articles].forEach(e => {
e.classList.remove('zen-mode-disabling');
});
}, 1000);
}
}
});
|