我已经在网站上设置了一个 PHP 视频浏览器(检查视频 pod),当单击视频缩略图时,应该会弹出一个视频并使用 FancyBox 脚本播放,但视频只是没有加载。为什么是这样?
问问题
2754 次
1 回答
0
您正在使用 fancybox v2.x 和 fancybox v1.3.x 的选项(它们彼此不兼容。)
你最好的选择是摆脱这个脚本:
<script type="text/javascript">
$(".videobox").click(function () {
$.fancybox({
'padding': 0,
'autoScale': false,
'transitionIn': 'none',
'transitionOut': 'none',
'title': this.title,
'width': 680,
'height': 495,
'href': this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
'type': 'swf',
'swf': {
'wmode': 'transparent',
'allowfullscreen': 'true'
}
});
return false;
});
</script>
试试这个:
<script type="text/javascript">
$(document).ready(function () {
$(".videobox").fancybox({
width: 680,
height: 495,
type: "iframe"
}); // fancybox
}); // ready
</script>
请注意我们正在使用type : "iframe"
,因为您使用的是 youtubeembed
模式
旁注:当您实际需要单个实例(最好是最新版本)以避免意外错误时,您正在加载两个版本的 jQuery(1.7.1 和 1.7.2)。
于 2012-07-09T19:16:36.427 回答