Wordpress/wp-admin/js/accordion.js
Mark Jaquith bfd0b6fb37 Refactor the Customizer accordion so that it can be used in other locations.
fixes #23449. props lessbloat, aaroncampbell

git-svn-id: https://develop.svn.wordpress.org/trunk@23417 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-14 22:58:04 +00:00

51 lines
1.5 KiB
JavaScript

jQuery(document).ready( function($) {
// Expand/Collapse
$('.accordion-section-title').on('click keydown', function( event ) {
if ( event.type === 'keydown' && 13 !== event.which ) // enter
return;
var clicked = $( this ).closest( '.accordion-section' );
if ( clicked.hasClass('cannot-expand') )
return;
clicked.closest( '.accordion-container' ).find( '.accordion-section' ).not( clicked ).removeClass( 'open' );
clicked.toggleClass( 'open' );
event.preventDefault();
});
});
jQuery(document).ready( function($) {
// Expand/Collapse
$('.accordion-section-title').on('click keydown', function( event ) {
if ( event.type === 'keydown' && 13 !== event.which ) // enter
return;
var clicked = $( this ).closest( '.accordion-section' );
if ( clicked.hasClass('cannot-expand') )
return;
clicked.closest( '.accordion-container' ).find( '.accordion-section' ).not( clicked ).removeClass( 'open' );
clicked.toggleClass( 'open' );
event.preventDefault();
});
});
jQuery(document).ready( function($) {
// Expand/Collapse
$('.accordion-section-title').on('click keydown', function( event ) {
if ( event.type === 'keydown' && 13 !== event.which ) // enter
return;
var clicked = $( this ).closest( '.accordion-section' );
if ( clicked.hasClass('cannot-expand') )
return;
clicked.closest( '.accordion-container' ).find( '.accordion-section' ).not( clicked ).removeClass( 'open' );
clicked.toggleClass( 'open' );
event.preventDefault();
});
});