From 46bbcd9a0cef38fe1265740d9be40e20d1909654 Mon Sep 17 00:00:00 2001 From: Isarra Date: Wed, 28 Aug 2019 20:44:31 +0000 Subject: [PATCH] Cleanup js clicky stuff a bit more Change-Id: I5c4d6da26ca1c6b92c4aeabd47421567c3adc673 --- resources/main.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/resources/main.js b/resources/main.js index b5cc589..8700bd2 100644 --- a/resources/main.js +++ b/resources/main.js @@ -7,22 +7,20 @@ $( function () { /** * Desktop menu click-toggling + * + * We're not even checking if it's desktop because the classes in play have no effect + * on mobile regardless... this may break things at some point, though. */ $( function () { // sidebar-chunk only applies to desktop-small, but the toggles are hidden at - // other resolutions regardless and the css overrides any visible effects. So - // whatever. + // other resolutions regardless and the css overrides any visible effects. var dropdowns = '#personal, #p-variants-desktop, .sidebar-chunk'; /** * Close all dropdowns */ function closeOpen() { - $( dropdowns ).each( function () { - if ( $( this ).hasClass( 'dropdown-active' ) ) { - $( this ).removeClass( 'dropdown-active' ); - } - } ); + $( dropdowns ).removeClass( 'dropdown-active' ); } /** @@ -40,7 +38,7 @@ $( function () { $( this ).addClass( 'dropdown-active' ); } } ); - $( document ).click( function ( e ) { + $( document ).on( 'click', function ( e ) { if ( $( e.target ).closest( dropdowns ).length > 0 ) { // Clicked inside an open menu; don't close anything } else {