From 974508b2216d0dd596a9dfbf8db4c0fe95098c4a Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Wed, 10 Jul 2013 16:32:09 +0000 Subject: [PATCH] Add sliding animations to the accordion. props kovshenin, DrewAPicture, helen. fixes #23890. git-svn-id: https://develop.svn.wordpress.org/trunk@24644 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/css/wp-admin.css | 6 +++--- wp-admin/js/accordion.js | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/wp-admin/css/wp-admin.css b/wp-admin/css/wp-admin.css index ad7dd6b052..6a5149ffda 100644 --- a/wp-admin/css/wp-admin.css +++ b/wp-admin/css/wp-admin.css @@ -8884,9 +8884,6 @@ a.widget-control-edit { .accordion-section.open .accordion-section-content, .no-js .accordion-section .accordion-section-content { display: block; - background: #fdfdfd; - border-left: 1px solid #dfdfdf; - border-right: 1px solid #dfdfdf; } .accordion-section.open:hover { @@ -8897,6 +8894,9 @@ a.widget-control-edit { display: none; padding: 10px 20px 15px; overflow: hidden; + background: #fdfdfd; + border-left: 1px solid #dfdfdf; + border-right: 1px solid #dfdfdf; } .accordion-section-title { diff --git a/wp-admin/js/accordion.js b/wp-admin/js/accordion.js index ac9af672db..6510f701e2 100644 --- a/wp-admin/js/accordion.js +++ b/wp-admin/js/accordion.js @@ -5,12 +5,16 @@ jQuery(document).ready( function($) { return; 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') ) 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' ); }); });