Disable snapper on bigger screens and on public/login page

This commit is contained in:
Morris Jobke 2014-06-06 01:20:31 +02:00
parent 9063a25bb4
commit 584c47b433
1 changed files with 51 additions and 32 deletions

View File

@ -1132,6 +1132,8 @@ function initCore() {
setupMainMenu(); setupMainMenu();
// just add snapper for logged in users
if($('#body-login, #body-public').length === 0) {
// App sidebar on mobile // App sidebar on mobile
var snapper = new Snap({ var snapper = new Snap({
@ -1166,6 +1168,23 @@ function initCore() {
} }
snapper.close(); snapper.close();
}); });
var toggleSnapperOnSize = function() {
if($(window).width() > 768) {
snapper.close();
snapper.disable();
} else {
snapper.enable();
}
};
$(window).resize(toggleSnapperOnSize);
// initial call
toggleSnapperOnSize();
}
} }
$(document).ready(initCore); $(document).ready(initCore);