wp/wp-admin/js/accordion.js
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    33 
    33 
    34 	$( document ).ready( function () {
    34 	$( document ).ready( function () {
    35 
    35 
    36 		// Expand/Collapse accordion sections on click.
    36 		// Expand/Collapse accordion sections on click.
    37 		$( '.accordion-container' ).on( 'click keydown', '.accordion-section-title', function( e ) {
    37 		$( '.accordion-container' ).on( 'click keydown', '.accordion-section-title', function( e ) {
    38 			if ( e.type === 'keydown' && 13 !== e.which ) { // "return" key
    38 			if ( e.type === 'keydown' && 13 !== e.which ) { // "Return" key.
    39 				return;
    39 				return;
    40 			}
    40 			}
    41 
    41 
    42 			e.preventDefault(); // Keep this AFTER the key filter above
    42 			e.preventDefault(); // Keep this AFTER the key filter above.
    43 
    43 
    44 			accordionSwitch( $( this ) );
    44 			accordionSwitch( $( this ) );
    45 		});
    45 		});
    46 
    46 
    47 	});
    47 	});
    78 			siblings.find( '.accordion-section-content' ).show().slideUp( 150 );
    78 			siblings.find( '.accordion-section-content' ).show().slideUp( 150 );
    79 			content.toggle( false ).slideToggle( 150 );
    79 			content.toggle( false ).slideToggle( 150 );
    80 			section.toggleClass( 'open' );
    80 			section.toggleClass( 'open' );
    81 		}
    81 		}
    82 
    82 
    83 		// We have to wait for the animations to finish
    83 		// We have to wait for the animations to finish.
    84 		setTimeout(function(){
    84 		setTimeout(function(){
    85 		    container.removeClass( 'opening' );
    85 		    container.removeClass( 'opening' );
    86 		}, 150);
    86 		}, 150);
    87 
    87 
    88 		// If there's an element with an aria-expanded attribute, assume it's a toggle control and toggle the aria-expanded value.
    88 		// If there's an element with an aria-expanded attribute, assume it's a toggle control and toggle the aria-expanded value.