2013-05-13 3 views
1

AnythingSlider가 비디오 프레임으로 돌아 왔을 때 Vimeo 비디오를 다시 재생하려면 어떻게해야합니까?Vimeo 및 AnythingSlider

 <script> 
     // DOM Ready 
     $(function(){ 
      $('#slider').anythingSlider({ 
       resizeContents  : true, 
       addWmodeToObject : 'transparent', 
       navigationFormatter : function(index, panel){ // Format navigation labels with text 
        return ['Promo Video', 'Photo #1', 'Photo #2', 'Photo #3', 'Photo #4'][index - 1]; 
       }, 
       startPanel   : 1, 
       autoPlay   : true, 
       delay    : 5000 
      }); 
     }); 
    </script> 




     <div id="slider_holder" style="width:984px;height:610px;"> 
      <ul id="slider"> 
       <li class="panel1"> 
        <iframe src="http://player.vimeo.com/video/55968550?title=0&amp;byline=0&amp;portrait=0" width="984" height="554" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> 
       </li> 
       <li class="panel2"> 
        Photo #1 
       </li> 
       <li class="panel3"> 
        Photo #2 
       </li> 
       <li class="panel4"> 
        Photo #3 
       </li> 
       <li class="panel5"> 
        Photo #4 
       </li> 
      </ul> 
     </div> 

슬라이더가 비디오를 재생 한 후 현재, 사진을 통해 이동 한 다음 다시 비디오로 간다 - 비디오는 마지막에 남아있다. 처음부터 비디오를 다시 시작할 수있는 방법이 있습니까?

답변

0

AnythingSlider (v1.9 이상)의 최신 버전을 사용하면 비디오 확장 코드가 AnythingSlider 플러그인과 별도로 호출됩니다. 이 완료된 후 그래서, 당신은 비디오를 다시 시작 (demo를) 다음 코드를 사용할 수 있습니다

/* play video when it comes into view, even after it has completed */ 
$.fn.anythingSliderVideo.services.vimeo1.cont = function(base, $vid, index) { 
    base.video.postMsg('{"method":"play"}', $vid[0].id); 
}; 

$(function() { 
    $('#slider') 
    .anythingSlider({ 
     resizeContents: true, 
     navigationFormatter: function (index, panel) { 
      return ['Promo Video', 'Photo #1', 'Photo #2', 'Photo #3', 'Photo #4'][index - 1]; 
     }, 
     startPanel: 1, 
     autoPlay: true, 
     delay: 5000 
    }) 
    .anythingSliderVideo({ 
     wmode: 'transparent&autoplay=1' // (hack) add autoplay code here 
    }); 
}); 

그것은 해킹의 종류,하지만 당신은 단지 시작 페이지에 하나 비디오가있는 경우, 다음 있도록 동영상 자동 재생의 경우 wmode 옵션에 &autoplay=1을 추가합니다.