WordPress/wp-admin/js/accordion.js
Mark Jaquith 4dd2707c60 Simplify the accordion sibling-section-closing JS.
see #23890

git-svn-id: http://core.svn.wordpress.org/trunk@23858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-29 09:30:48 +00:00

17 lines
497 B
JavaScript

jQuery(document).ready( function($) {
// Expand/Collapse
$('.accordion-container').on( 'click keydown', '.accordion-section-title', function(e) {
if ( e.type === 'keydown' && 13 !== e.which ) // "return" key
return;
e.preventDefault(); // Keep this AFTER the key filter above
var section = $( this ).closest( '.accordion-section' );
if ( section.hasClass('cannot-expand') )
return;
section.siblings( '.open' ).removeClass( 'open' );
section.toggleClass( 'open' );
});
});