Blueprint-SlidePushMenus
Blueprint-SlidePushMenus copied to clipboard
Close menu click outside content
How about adding if click outside content menu close the menu?
+1
+1
Opening and closing the menu is all controlled by CSS classes, so just tie a click event onto the page wrapper, or something along those lines, and use Classie to toggle the classes off.
+1
$(function() { $("#showBottom").on("click", function(e) { $("#cbp-spmenu-s4").toggleClass("cbp-spmenu-open"); }); $(document).on("click", function(e) { if ($(e.target).is("#cbp-spmenu-s4, #showBottom") === false) { $("#cbp-spmenu-s4").removeClass("cbp-spmenu-open"); } }); });