mirror of
https://github.com/jquery/jquery.git
synced 2026-02-06 17:24:54 -05:00
Keep track of a hiding state for toggle based animations - Fixes #8685
Closes gh-1018
This commit is contained in:
11
src/effects.js
vendored
11
src/effects.js
vendored
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user