aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.accordion.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-07-25 11:53:14 -0400
committerScott González <scott.gonzalez@gmail.com>2011-07-25 11:53:14 -0400
commit19a9de7e668cdb3b76c3b733d0147f1853cb38a5 (patch)
treea259b421dd77cbec27e55db9b4d1104bf5214a2a /ui/jquery.ui.accordion.js
parentdaadc343be2f139e82719e2e5ff466aa19ec166f (diff)
parent51ee3be39829e339c8e4bccb532347944e600ca5 (diff)
downloadjquery-ui-19a9de7e668cdb3b76c3b733d0147f1853cb38a5.tar.gz
jquery-ui-19a9de7e668cdb3b76c3b733d0147f1853cb38a5.zip
Merge branch 'master' into core-1.6.1
Conflicts: demos/menubar/default.html tests/unit/autocomplete/autocomplete.html tests/visual/effects/effects.all.html ui/jquery.ui.menu.js ui/jquery.ui.popup.js
Diffstat (limited to 'ui/jquery.ui.accordion.js')
-rw-r--r--ui/jquery.ui.accordion.js36
1 files changed, 20 insertions, 16 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js
index 14b67586e..c976e3e69 100644
--- a/ui/jquery.ui.accordion.js
+++ b/ui/jquery.ui.accordion.js
@@ -12,6 +12,8 @@
* jquery.ui.widget.js
*/
(function( $, undefined ) {
+
+var lastToggle = {};
// TODO: use ui-accordion-header-active class and fix styling
$.widget( "ui.accordion", {
@@ -37,8 +39,6 @@ $.widget( "ui.accordion", {
var self = this,
options = self.options;
- self.running = false;
-
self.element.addClass( "ui-accordion ui-widget ui-helper-reset" );
self.headers = self.element.find( options.header )
@@ -161,6 +161,13 @@ $.widget( "ui.accordion", {
return;
}
+ if ( key === "event" ) {
+ if ( this.options.event ) {
+ this.headers.unbind( this.options.event + ".accordion", this._eventHandler );
+ }
+ this._setupEvents( value );
+ }
+
this._super( "_setOption", key, value );
// setting collapsible: false while collapsed; open first panel
@@ -168,10 +175,6 @@ $.widget( "ui.accordion", {
this._activate( 0 );
}
- if ( key === "event" ) {
- this._setupEvents( value );
- }
-
if ( key === "icons" ) {
this._destroyIcons();
if ( value ) {
@@ -293,7 +296,6 @@ $.widget( "ui.accordion", {
},
_setupEvents: function( event ) {
- this.headers.unbind( ".accordion" );
if ( event ) {
this.headers.bind( event.split( " " ).join( ".accordion " ) + ".accordion",
$.proxy( this, "_eventHandler" ) );
@@ -318,8 +320,6 @@ $.widget( "ui.accordion", {
event.preventDefault();
if ( options.disabled ||
- // can't switch during an animation
- this.running ||
// click on active header, but not collapsible
( clickedIsActive && !options.collapsible ) ||
// allow canceling activation
@@ -360,7 +360,6 @@ $.widget( "ui.accordion", {
toShow = data.newContent,
toHide = data.oldContent;
- self.running = true;
function complete() {
self._completed( data );
}
@@ -381,6 +380,8 @@ $.widget( "ui.accordion", {
animations[ animation ]({
toShow: toShow,
toHide: toHide,
+ prevShow: lastToggle.toShow,
+ prevHide: lastToggle.toHide,
complete: complete,
down: toShow.length && ( !toHide.length || ( toShow.index() < toHide.index() ) )
}, additional );
@@ -411,8 +412,6 @@ $.widget( "ui.accordion", {
var toShow = data.newContent,
toHide = data.oldContent;
- this.running = false;
-
if ( this.options.heightStyle === "content" ) {
toShow.add( toHide ).css({
height: "",
@@ -434,6 +433,11 @@ $.widget( "ui.accordion", {
$.extend( $.ui.accordion, {
animations: {
slide: function( options, additions ) {
+ if ( options.prevShow || options.prevHide ) {
+ options.prevHide.stop( true, true );
+ options.toHide = options.prevShow;
+ }
+
var showOverflow = options.toShow.css( "overflow" ),
hideOverflow = options.toHide.css( "overflow" ),
percentDone = 0,
@@ -445,6 +449,9 @@ $.extend( $.ui.accordion, {
easing: "swing",
duration: 300
}, options, additions );
+
+ lastToggle = options;
+
if ( !options.toHide.size() ) {
originalWidth = options.toShow[0].style.width;
options.toShow
@@ -501,10 +508,7 @@ $.extend( $.ui.accordion, {
.filter( ":visible" )
.animate( hideProps, {
step: function( now, settings ) {
- // only calculate the percent when animating height
- // IE gets very inconsistent results when animating elements
- // with small values, which is common for padding
- if ( settings.prop == "height" ) {
+ if ( settings.prop == "height" || settings.prop == "paddingTop" || settings.prop == "paddingBottom" ) {
percentDone = ( settings.end - settings.start === 0 ) ? 0 :
( settings.now - settings.start ) / ( settings.end - settings.start );
}