diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
index 66d63bd..43084a5 100644
|
|
|
131 | 131 | * @augments wp.customize.Class |
132 | 132 | */ |
133 | 133 | Container = api.Class.extend({ |
134 | | defaultActiveArguments: { duration: 'fast' }, |
135 | | defaultExpandedArguments: { duration: 'fast' }, |
| 134 | defaultActiveArguments: { duration: 'fast', completeCallback: $.noop }, |
| 135 | defaultExpandedArguments: { duration: 'fast', completeCallback: $.noop }, |
136 | 136 | |
137 | 137 | initialize: function ( id, options ) { |
138 | 138 | var container = this; |
… |
… |
|
217 | 217 | */ |
218 | 218 | onChangeActive: function ( active, args ) { |
219 | 219 | var duration = ( 'resolved' === api.previewer.deferred.active.state() ? args.duration : 0 ); |
220 | | if ( active ) { |
| 220 | if ( ! $.contains( document, this.container ) ) { |
| 221 | // jQuery.fn.slideUp is not hiding an element if it is not in the DOM |
| 222 | this.container.toggle( active ); |
| 223 | args.completeCallback(); |
| 224 | } else if ( active ) { |
221 | 225 | this.container.stop( true, true ).slideDown( duration, args.completeCallback ); |
222 | 226 | } else { |
223 | 227 | this.container.stop( true, true ).slideUp( duration, args.completeCallback ); |
… |
… |
|
640 | 644 | * @augments wp.customize.Class |
641 | 645 | */ |
642 | 646 | api.Control = api.Class.extend({ |
643 | | defaultActiveArguments: { duration: 'fast' }, |
| 647 | defaultActiveArguments: { duration: 'fast', completeCallback: $.noop }, |
644 | 648 | |
645 | 649 | initialize: function( id, options ) { |
646 | 650 | var control = this, |
… |
… |
|
781 | 785 | * @param {Object} args merged on top of this.defaultActiveArguments |
782 | 786 | */ |
783 | 787 | onChangeActive: function ( active, args ) { |
784 | | if ( active ) { |
| 788 | if ( ! $.contains( document, this.container ) ) { |
| 789 | // jQuery.fn.slideUp is not hiding an element if it is not in the DOM |
| 790 | this.container.toggle( active ); |
| 791 | args.completeCallback(); |
| 792 | } else if ( active ) { |
785 | 793 | this.container.slideDown( args.duration, args.completeCallback ); |
786 | 794 | } else { |
787 | 795 | this.container.slideUp( args.duration, args.completeCallback ); |
diff --git src/wp-admin/js/customize-widgets.js src/wp-admin/js/customize-widgets.js
index 3338f7b..eac16a5 100644
|
|
|
405 | 405 | */ |
406 | 406 | api.Widgets.WidgetControl = api.Control.extend({ |
407 | 407 | defaultExpandedArguments: { |
408 | | duration: 'fast' |
| 408 | duration: 'fast', |
| 409 | completeCallback: $.noop |
409 | 410 | }, |
410 | 411 | |
411 | 412 | initialize: function ( id, options ) { |