[英]How do I remove slideUp() slideDown() from the fx queue in JavaScript?
I've had to make a custom animation queue to timeline my animations.我必须制作一个自定义 animation 队列来为我的动画制作时间线。
Is there a way to remove the pre-defined slideUp() or slideDown() animations from the fx queue?有没有办法从 fx 队列中删除预定义的 slideUp() 或 slideDown() 动画? I know you use queue:false when using animate(), but is it possible to do with a predefined animation?
我知道您在使用 animate() 时使用 queue:false,但是可以使用预定义的 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:查看 je jQuery 源代码,使用带有 4 个参数的 animate() 重载执行预定义动画:
// 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).可能的解决方案可能是使用动画重载在您的代码中重新定义它们,该重载将选项 object 文字作为第二个参数(就像您已经在使用一样)。 Although I would ne recommend this as it sounds like a lot of work, not so reliable in the end...
虽然我不会推荐这个,因为这听起来像是很多工作,但最终并不那么可靠......
Hope this helps, d.希望这会有所帮助,d。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.