[英]How do you make a div show when vimeo video is finished?
I'm really new to JS, and can't figure out these event listeners on Vimeo. 我真的是JS新手,无法在Vimeo上弄清楚这些事件侦听器。 Basically I need a div, below the video, to be hidden while the video plays, and appear when the video finishes.
基本上,我需要在视频下方隐藏一个div,以便在视频播放时将其隐藏,并在视频播放完毕后显示。 Please help, as I have no idea where to start.
请帮忙,因为我不知道从哪里开始。 I've tried everything.
我已经尝试了一切。
This is what I have so far, but no luck: 这是我到目前为止所拥有的,但是没有运气:
<div style="margin-left:2%;" >
<iframe id="flash" src="http://player.vimeo.com/video/50234176?api=1&&portrait=0&byline=0&autoplay=1&title=0;player_id=player_1" width="760" height="460" frameborder="0"></iframe>
</div>
<div id="hello" >hello</div>
<script>
$('#hello').hide();
var iframe = $('#player1')[0],
player = $f(iframe),
player.addEvent('ready', function() {
player.addEvent('finish', function(){
$('#hello').show();
});
});
</script>
Initially, your div can be hidden by using a simple CSS display:none
, or calling $('#yourDivID').hide();
最初,可以使用简单的CSS
display:none
或调用$('#yourDivID').hide();
So, to show your div again when the video is finished, try this way: 因此,要在视频播放完毕后再次显示div,请尝试以下方法:
player.addEvent('ready', function() {
player.addEvent('finish', function(){
$('#yourDivID').show();
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.