是否可以通过具有动态 href 的 jQuery 函数传递 Vimeo 播放器变量?
I have links with vimeo urls in them:
<a class="video" href="http://vimeo.com/9532951">link 1</a>
<a class="video" href="http://vimeo.com/8228482">link 2</a>
Then I have manual fancybox call that loads the video into a fancybox:
<script>
$("a.video").click(function() {
$.fancybox({
'padding' : 0,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'title' : this.title,
'width' : 400,
'height' : 265,
'href' : this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1'),
'type' : 'swf'
});
return false;
});
</script>
我一生都无法弄清楚如何将参数传递给视频播放器...autoplay=1 或 fullscreen=1 等等。我尝试了一些方法,但没有任何效果。我以为这就像添加 'swf' : 'autoplay=1'
但这不起作用。无论如何,任何帮助将不胜感激,
谢谢。
I have links with vimeo urls in them:
<a class="video" href="http://vimeo.com/9532951">link 1</a>
<a class="video" href="http://vimeo.com/8228482">link 2</a>
Then I have manual fancybox call that loads the video into a fancybox:
<script>
$("a.video").click(function() {
$.fancybox({
'padding' : 0,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'title' : this.title,
'width' : 400,
'height' : 265,
'href' : this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1'),
'type' : 'swf'
});
return false;
});
</script>
I cannot for the life of me figure out how to pass arguments to the video player...autoplay=1 or fullscreen=1 etc etc etc. I've tried a couple of things but nothing has worked. Was thinking it was something like adding 'swf' : 'autoplay=1'
but that did not work. Anyway, any help would be much appreciated
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是另一个不需要唯一 ID 的可行解决方案:
Here's another working solution that doesn't require a unique ID:
我已经找到了一种方法,你可以做到。为每个链接添加一个唯一的 ID,并将其调用设置为
$("a.video").click(function() {
var video_fancybox = {
“填充”:0,
'自动缩放':假,
'transitionIn' : '无',
'transitionOut':'无',
'标题' : this.title,
“宽度”:400,
“高度”:265,
'href' : this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1'),
'类型':'swf',
'swf':{
'wmode' : '透明',
'允许全屏' : 'true'
}
};
$("#vimeo_test3").fancybox( // 打开用于获取链接
$.extend(video_fancybox, {'href' : 'http://vimeo.com/moogaloop.swf?clip_id=3979490&fullscreen=1'})
);
返回假;
});
I have found a way you can do it. Add a unike ID to eatch of your links and set the call for them as this
$("a.video").click(function() {
var video_fancybox = {
'padding' : 0,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'title' : this.title,
'width' : 400,
'height' : 265,
'href' : this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1'),
'type' : 'swf',
'swf' : {
'wmode' : 'transparent',
'allowfullscreen' : 'true'
}
};
$("#vimeo_test3").fancybox( // On for eatch link
$.extend(video_fancybox, {'href' : 'http://vimeo.com/moogaloop.swf?clip_id=3979490&fullscreen=1'})
);
return false;
});
尝试添加
Try adding
请务必将“autoplay”替换为“autostart”并将其设置为“true”。
Flash 播放器不将“自动播放”理解为命令。
代码将是这样的:
Just be sure to replace "autoplay" with "autostart" and set it to "true".
Flash players don't understand "autoplay" as a command.
Code will be like this: