blob: 92c55915087c44a113f3a394014005371d1c8e86 (
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
|
(function() {
var SOURCES = window.TEXT_VARIABLES.sources;
window.Lazyload.js(SOURCES.jquery, function() {
var $pageMask = $('.js-page-mask');
var $pageRoot = $('.js-page-root');
var $sidebarShow = $('.js-sidebar-show');
var $sidebarHide = $('.js-sidebar-hide');
function freeze(e) {
if (e.target === $pageMask[0]) {
e.preventDefault();
}
}
function stopBodyScrolling(bool) {
if (bool === true) {
window.addEventListener('touchmove', freeze, { passive: false });
} else {
window.removeEventListener('touchmove', freeze, { passive: false });
}
}
$sidebarShow.on('click', function() {
stopBodyScrolling(true); $pageRoot.addClass('show-sidebar');
});
$sidebarHide.on('click', function() {
stopBodyScrolling(false); $pageRoot.removeClass('show-sidebar');
});
});
})();
|