我试图将BigVideo.js包含在一个单独的div(如英雄单位)中,但它会继续接管身体背景。我在BigVideo.js主页上使用示例代码:
<script type="text/javascript"> var BV; $(function() { // initialize BigVideo BV = new $.BigVideo(); BV.init(); BV.show('http://video-js.zencoder.com/oceans-clip.mp4',{ambient:true}); }); </script>
我试着做这样的事情:
<script type="text/javascript"> var BV; $(function() { // initialize BigVideo BV = new $.BigVideo({ container: $('video-wrap') }); BV.init(); BV.show('http://video-js.zencoder.com/oceans-clip.mp4',{ambient:true}); }); </script>
解决方法
您需要正确指定BigVideo对象的容器(我不知道是否是一个错字,但一切似乎都可以)
ID
BV = new $.BigVideo({container: $('#video-wrap')});
类
BV = new $.BigVideo({container: $('.video-wrap')});
在创建对象时,它设置为默认的主体(BigVideo Code):
var defaults = { // If you want to use a single mp4 source,set as true useFlashForFirefox:true,// If you are doing a playlist,the video won't play the first time // on a touchscreen unless the play event is attached to a user click forceAutoplay:false,controls:false,doLoop:false,container:$('body'),//Container shrinkable:false };
然后,您发送的选项将使用$ .extend()进行合并
var settings = $.extend({},defaults,options);