简体   繁体   English

如何从 JavaScript 的 fx 队列中删除 slideUp() slideDown()?

[英]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.

相关问题 如何在AngularJS中进行slideDown或slideUp - How can I do slideDown or slideUp in AngularJS 如何使此slideDown / slideUp在不同的类上正常工作? - How do I make this slideDown/slideUp work properly with different classes? jQuery的remove()绕过FX队列? 如何仅在链的末端使用它? - jQuery's remove() bypass the FX queue? How do I use it only at the end of my chain? Javascript slideUp / slideDown /一个按钮 - Javascript slideUp / slideDown / one button 如何将“ slideup()”和“ slidedown()”函数应用于可折叠的Jquery Mobile 1.4.5? 杰菲德 - How do I apply the “slideup()” and “slidedown()” function to a , Jquery Mobile 1.4.5, collapsible? JFIDDLE 我有一个菜单,当我从ul按下另一个li时,我不会如何正确使用slideToggle,slideDown和slideUp? - I have a menu and I don't how to use proprely slideToggle, to slideDown and slideUp when i pressed another li from ul? SlideUp slideDown - SlideUp slideDown 如何在元素的slideUp()之前阻止滚动和主体高度,并在新元素的slideDown()之后移除CSS? -jQuery的 - How block scroll and height of body before slideUp() of element and remove css after slideDown() of new element ? - Jquery 从最后一张幻灯片到第一张幻灯片使用slideUp / slideDown - From the last slide to the first slide with slideUp/slideDown 如何使SlideUp和slideDown jQuery动画更平滑 - How to make slideUp and slideDown jQuery animation smoother
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM