简体   繁体   English

如何在jquery中触发动画时间?

[英]How to trigger the animation time in jquery?

For now my code is has an eventListener for video files.现在我的代码有一个用于视频文件的事件监听器。 So soon as the video is finished the function starts.视频一完成,功能就开始了。 But instead to have a video file I want to create an animation.但是为了有一个视频文件,我想创建一个动画。 And soon as that animation is ended I want the function to start.一旦该动画结束,我希望该功能启动。

<div id="intro" class="exitBtnCol">
    <video id="intro_text" width="728" height="90" autoplay>
        <source src="intro_text_video.mp4" type="video/mp4">
        <source src="intro_text_video.webM" type="video/webM">
    </video>
</div>
openerVid.addEventListener( 'ended', startResolve, false); 

this is what I have now.这就是我现在所拥有的。

You can use the animate() method to perform an animation on an element.您可以使用animate()方法对元素执行动画。 This method also takes a callback function as a parameter when you can call startResolve() from when the animation ends.当您可以从动画结束时调用startResolve()时,此方法还将回调函数作为参数。 Try this:尝试这个:

$(openerVid).on('ended', function() {
    $('#foo').animate({
        opacity: 1 // change as required
    }, 500, startResolve);
});

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

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