我正在尝试将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代码):

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);

10-07 21:02