blob: f465e7e95b87bcc55da693aad2f87ac59e5b5785 (
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
|
import NavigationShrinker from './navigation_shrinker.js';
import Scroll from './scroll.js';
let fold;
let was_below_the_fold = false;
const scroll = function(scrolltop) {
var is_below_the_fold = scrolltop > fold,
menu;
if (is_below_the_fold !== was_below_the_fold) {
$('body').toggleClass('fixed', is_below_the_fold);
was_below_the_fold = is_below_the_fold;
}
};
const HeaderMagic = {
enable() {
fold = $('#navigation-level-1').height();
Scroll.addHandler('header', scroll);
},
disable() {
Scroll.removeHandler('header');
$('body').removeClass('fixed');
}
};
export default HeaderMagic;
|