Add sliding animations to the accordion. props kovshenin, DrewAPicture, helen. fixes #23890.

git-svn-id: http://core.svn.wordpress.org/trunk@24644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Helen Hou-Sandí 2013-07-10 16:32:09 +00:00
parent bcd2644d92
commit 561a323362
2 changed files with 9 additions and 5 deletions

View File

@ -8884,9 +8884,6 @@ a.widget-control-edit {
.accordion-section.open .accordion-section-content, .accordion-section.open .accordion-section-content,
.no-js .accordion-section .accordion-section-content { .no-js .accordion-section .accordion-section-content {
display: block; display: block;
background: #fdfdfd;
border-left: 1px solid #dfdfdf;
border-right: 1px solid #dfdfdf;
} }
.accordion-section.open:hover { .accordion-section.open:hover {
@ -8897,6 +8894,9 @@ a.widget-control-edit {
display: none; display: none;
padding: 10px 20px 15px; padding: 10px 20px 15px;
overflow: hidden; overflow: hidden;
background: #fdfdfd;
border-left: 1px solid #dfdfdf;
border-right: 1px solid #dfdfdf;
} }
.accordion-section-title { .accordion-section-title {

View File

@ -5,12 +5,16 @@ jQuery(document).ready( function($) {
return; return;
e.preventDefault(); // Keep this AFTER the key filter above e.preventDefault(); // Keep this AFTER the key filter above
var section = $( this ).closest( '.accordion-section' ); var section = $( this ).closest( '.accordion-section' ),
siblings = section.siblings( '.open' ),
content = section.find( '.accordion-section-content' );
if ( section.hasClass('cannot-expand') ) if ( section.hasClass('cannot-expand') )
return; return;
section.siblings( '.open' ).removeClass( 'open' ); siblings.removeClass( 'open' );
siblings.find( '.accordion-section-content' ).show().slideUp( 150 );
content.toggle( section.hasClass( 'open' ) ).slideToggle( 150 );
section.toggleClass( 'open' ); section.toggleClass( 'open' );
}); });
}); });