简体   繁体   English

结合velocity.js的slideUp和begin:函数的使用

[英]Combine the use of velocity.js' slideUp and begin: function

How do you combine these two, so that one can slide an item up, but trigger some JS just as that animation starts.你如何将这两者结合起来,这样一个人可以向上滑动一个项目,但在动画开始时触发一些 JS。

SlideUp code向上滑动代码

 .velocity("slideUp", { delay: 500, duration: 1500 });

Begin: code开始:代码

$element.velocity({
    opacity: 0
}, { 
    /* Log all the animated divs. */
    begin: function(elements) { console.log(elements); }
});

Doing something like this doesn't work.做这样的事情是行不通的。

.velocity("slideUp", { delay: 500, duration: 1500 }), { 
    /* Log all the animated divs. */
    begin: function(elements) { console.log(elements); }
});

You have to put the begin property inside the options object:您必须将begin属性放在 options 对象中:

.velocity("slideUp", {
    delay: 500, duration: 150,
    begin: function(elements) { console.log(elements); }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM