Cleanup js clicky stuff a bit more

Change-Id: I5c4d6da26ca1c6b92c4aeabd47421567c3adc673
isekai
Isarra 6 years ago
parent 93e2ce0cdc
commit 46bbcd9a0c

@ -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 {

Loading…
Cancel
Save