Video.js,Infinite Scroll和Masonry:视频不会加载新加载的内容

时间:2013-08-05 02:24:34

标签: jquery-masonry infinite-scroll video.js

我正在使用infinite-scroll.js,video.js和masonry.js。第一页正确加载(即视频图像加载在“pintrest-style”框内的视频播放器中。但是,当用户向下滚动时,只有pintrest风格的“盒子加载空视频播放器(即没有图像和视频)不要玩。我想我应该以某种方式重新初始化video.js,但我无法弄清楚如何正确地使用多个视频。我的js代码如下。如何让新装的盒子加载视频播放器?

  $container.infinitescroll({
debug: false,
//extraScrollPx: 40,
bufferPx: 40,
navSelector  : '#navigation',    // selector for the paged navigation 
nextSelector : '#navigation a',  // selector for the NEXT link (to page 2)
itemSelector : '.masonry_object',     // selector for all items you'll retrieve
loading: {
    finishedMsg: null,
    img: "img/loader.gif",
    msg: null,
    msgText: " ",
    speed: 'fast',
  }
},
// trigger Masonry as a callback
function( newElements ) {
  // hide new items while they are loading
  var $newElems = $( newElements ).css({display:"none"},{ opacity: 0 });
  // ensure that images load before adding to masonry layout
  $newElems.imagesLoaded(function(){
    // show elems now they're ready

    $container.masonry( 'appended', $newElems, true ); 
    $newElems.show().delay(1000).animate({ opacity: 1 },1000);
    $newElems.videojs("example_video_number", { "controls": true, "autoplay": false, "preload": "auto" });
  });
}

);

0 个答案:

没有答案