summaryrefslogtreecommitdiffstats
path: root/core/js/public/publicpage.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/js/public/publicpage.js')
-rw-r--r--core/js/public/publicpage.js15
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');
+ }
+});