admin管理员组文章数量:1325236
I have a site where I'm using a JavaScript to add or remove a css class. Using this method I hide a div or show a div, as I need it. It works great.
The problem is one div opens a Video with a JWplayer, when I hide the "window" or better say, the div. The sound is still playing, so I need a code to put stop on the video when someone clicks the "hide" button or close button.
How do you do that? I have no idea.
Thanks
HTML
<div class="videoquon">
<div class='my-video-close'></div>
<div id='my-video'></div>
<script type='text/javascript'>
jwplayer('my-video').setup({
file: 'qvideo.f4v',
width: '600',
height: '337'
});
</script>
</div>
JavaScript
$('div.vidreveal a').click(
function(event) {
event.stopPropagation();
$('div.videoquon').slideToggle(300);
}
);
$('div.my-video-close').click(
function(event) {
event.stopPropagation();
$('div.videoquon').slideToggle(300);
}
);
I have a site where I'm using a JavaScript to add or remove a css class. Using this method I hide a div or show a div, as I need it. It works great.
The problem is one div opens a Video with a JWplayer, when I hide the "window" or better say, the div. The sound is still playing, so I need a code to put stop on the video when someone clicks the "hide" button or close button.
How do you do that? I have no idea.
Thanks
HTML
<div class="videoquon">
<div class='my-video-close'></div>
<div id='my-video'></div>
<script type='text/javascript'>
jwplayer('my-video').setup({
file: 'qvideo.f4v',
width: '600',
height: '337'
});
</script>
</div>
JavaScript
$('div.vidreveal a').click(
function(event) {
event.stopPropagation();
$('div.videoquon').slideToggle(300);
}
);
$('div.my-video-close').click(
function(event) {
event.stopPropagation();
$('div.videoquon').slideToggle(300);
}
);
Share
Improve this question
edited Apr 9, 2013 at 18:02
Phil Miller
38.2k13 gold badges70 silver badges91 bronze badges
asked Apr 9, 2013 at 17:49
DreaminMedia QueretaroDreaminMedia Queretaro
2291 gold badge5 silver badges17 bronze badges
1 Answer
Reset to default 6I don't know JW Player, but judging by their docs, I'm going to go with
$( 'div.my-video-close' ).click( function( event ) {
event.stopPropagation();
jwplayer( 'my-video' ).stop();
$( 'div.videoquon' ).slideToggle( 300 );
});
...or jwplayer( 'my-video' ).pause();
depending on the desired effect.
本文标签: javascriptStop JWPlayer when hidden the div with the playerStack Overflow
版权声明:本文标题:javascript - Stop JWPlayer when hidden the div with the player - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742167135a2426033.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论