JQuery 点击显示时自动播放视频
我在导航面板上使用 JQuery,该面板的操作方式是单击以显示/隐藏。在“关于”面板上有一个小的 html5 视频,我想在点击显示时自动启动并在点击隐藏时停止视频。 “关于”面板的 ID 是:
<div class="panel2">
面板功能的示例代码:
$(document).ready(function(){
$(".triggerso").click(function(){
$(this).hide();
$(".panelso").show("fast");
$('.panelso').click(function(){
$(this).hide();
$('.triggerso').show("fast"); });
$(".panel").hide("slow");
$(".panel1").hide("slow");
$(".panel2").hide("slow");
$(".panel3").hide("slow");
return false;
});
});
非常感谢您的帮助。
安德里亚
I'm using JQuery on a navigational panel that operates as click to show/hide. On the "About" panel is small html5 video that I would like to auto start on click-show and stop video on click-hide.
The id for the "About" panel is:
<div class="panel2">
Sample code for how the panels function:
$(document).ready(function(){
$(".triggerso").click(function(){
$(this).hide();
$(".panelso").show("fast");
$('.panelso').click(function(){
$(this).hide();
$('.triggerso').show("fast"); });
$(".panel").hide("slow");
$(".panel1").hide("slow");
$(".panel2").hide("slow");
$(".panel3").hide("slow");
return false;
});
});
Thanks you so much for your help.
Andrea
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
请参阅此:
http://www.w3.org/TR/html5/video.html#video
和控件属性:
http://www.w3.org/TR/html5/video .html#attr-media-controls
可能媒体方法“.play()”和“.pause()”会帮助你
这样的事情:
“[0]”是获取html元素而不是一个 jQuery 对象。
See this:
http://www.w3.org/TR/html5/video.html#video
and the controls attribute:
http://www.w3.org/TR/html5/video.html#attr-media-controls
probably the media methods ".play()" and ".pause()" will help you
Something like this:
the "[0]" is to get the html element instead of a jQuery object.