diff options
author | Corey Frang <gnarf@gnarf.net> | 2012-11-07 19:23:24 -0600 |
---|---|---|
committer | Corey Frang <gnarf@gnarf.net> | 2012-11-07 19:23:24 -0600 |
commit | c45f6095f2d58a9fefd6bc788e50140acc7cf0c4 (patch) | |
tree | 1fc13e6853a10d39215de5d467cedee298e181c3 /src/effects.js | |
parent | 781a5c0b78a029b079aae970200d3e4edf543349 (diff) | |
download | jquery-c45f6095f2d58a9fefd6bc788e50140acc7cf0c4.tar.gz jquery-c45f6095f2d58a9fefd6bc788e50140acc7cf0c4.zip |
Keep track of a hiding state for toggle based animations - Fixes #8685
Closes gh-1018
Diffstat (limited to 'src/effects.js')
-rw-r--r-- | src/effects.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/effects.js b/src/effects.js index 3c10892a0..4b6b2e4da 100644 --- a/src/effects.js +++ b/src/effects.js @@ -234,7 +234,7 @@ jQuery.Animation = jQuery.extend( Animation, { function defaultPrefilter( elem, props, opts ) { /*jshint validthis:true */ - var index, prop, value, length, dataShow, tween, hooks, oldfire, + var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire, anim = this, style = elem.style, orig = {}, @@ -308,6 +308,7 @@ function defaultPrefilter( elem, props, opts ) { value = props[ index ]; if ( rfxtypes.exec( value ) ) { delete props[ index ]; + toggle = toggle || value === "toggle"; if ( value === ( hidden ? "hide" : "show" ) ) { continue; } @@ -318,6 +319,14 @@ function defaultPrefilter( elem, props, opts ) { length = handled.length; if ( length ) { dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } + + // store state if its toggle - enables .stop().toggle() to "reverse" + if ( toggle ) { + dataShow.hidden = !hidden; + } if ( hidden ) { jQuery( elem ).show(); } else { |