From 561a323362140529cfb9d4dfd9abec60e3ce3d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helen=20Hou-Sand=C3=AD?= 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: http://core.svn.wordpress.org/trunk@24644 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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' ); }); });