开发者

How do I remove slideUp() slideDown() from the fx queue in JavaScript?

I've had to mak开发者_运维问答e a custom animation queue to timeline my animations.

Is there a way to remove the pre-defined slideUp() or slideDown() animations from the fx queue? I know you use queue:false when using animate(), but is it possible to do with a predefined animation?


I guess it's not possible out of the box.

Looking at je jQuery source code, the pre-defined animations are executed using the animate() overload with 4 parameters:

// Generate shortcuts for custom animations
jQuery.each({
    slideDown: genFx( "show", 1 ),
    slideUp: genFx( "hide", 1 ),
    slideToggle: genFx( "toggle", 1 ),
    fadeIn: { opacity: "show" },
    fadeOut: { opacity: "hide" },
    fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
    jQuery.fn[ name ] = function( speed, easing, callback ) {
            return this.animate( props, speed, easing, callback );
    };
});

Possible solution could be to redefine them in you code using the animate overload that takes an option object literal as second param (like you are already using). Although I would ne recommend this as it sounds like a lot of work, not so reliable in the end...

Hope this helps, d.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜