From 52d02dc22faee3651a846b20969657d3d741d51a Mon Sep 17 00:00:00 2001 From: Joshua Carp Date: Wed, 5 Aug 2015 20:40:57 -0400 Subject: [PATCH] Hide dropdown toggles on clicking outside. [Resolves #426] --- static/js/init.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/static/js/init.js b/static/js/init.js index 5d59b7010..1c4508223 100644 --- a/static/js/init.js +++ b/static/js/init.js @@ -102,6 +102,15 @@ $(document).ready(function() { }); } + // Hide toggles on clicking outside toggle button or body + $(document.body).on('click', function(e) { + var $target = $(e.target); + if (!$('.js-toggle').has(e.target).length && + !$('.js-checkbox-filters').has(e.target).length) { + hideToggles(); + } + }); + $('.js-toggle').on('click keypress', function(e) { if (e.which === 13 || e.type === 'click') { var $this = $(this);