diff options
author | Julius Härtl <jus@bitgrid.net> | 2018-04-05 12:21:39 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-04-05 12:21:39 +0200 |
commit | bbeb3402b6bc778de393b6da1b5fdc214f825b16 (patch) | |
tree | c6acabcd87666f34beb3eb59bcf93a09338170fa /core/js/public | |
parent | cc3b1179fc2ad0051cb6043ff022cd033144a936 (diff) | |
download | nextcloud-server-bbeb3402b6bc778de393b6da1b5fdc214f825b16.tar.gz nextcloud-server-bbeb3402b6bc778de393b6da1b5fdc214f825b16.zip |
Move styling and menu handling to publicpage.js
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'core/js/public')
-rw-r--r-- | core/js/public/publicpage.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/core/js/public/publicpage.js b/core/js/public/publicpage.js index 31b862ba12a..1b37005540f 100644 --- a/core/js/public/publicpage.js +++ b/core/js/public/publicpage.js @@ -22,8 +22,19 @@ $(document).ready(function () { - console.log('public'); - $('#body-public .header-right .menutoggle').click(function() { + $('#body-public').find('.header-right .menutoggle').click(function() { $(this).next('.popovermenu').toggleClass('open'); }); }); + +$(document).mouseup(function(e) { + var toggle = $('#body-public').find('.header-right .menutoggle'); + var container = toggle.next('.popovermenu'); + + // if the target of the click isn't the menu toggle, nor a descendant of the + // menu toggle, nor the container nor a descendant of the container + if (!toggle.is(e.target) && toggle.has(e.target).length === 0 && + !container.is(e.target) && container.has(e.target).length === 0) { + container.removeClass('open'); + } +}); |