2013-10-19 97 views
0

我一直在努力爭取一段時間,並且有一個大腦放屁,所以我想尋求幫助。我使用的是Cycle2 Plugin,需要在videojs開始播放時暫停幻燈片播放我已經看過這個Discussion以及API Documentation,但我仍然無法看清楚。如何在videojs開始播放時暫停jQuery Cycle 2插件

這裏的每個單獨的幻燈片代碼:

<div class="slideshow-item" style="background: url({tag_Image (1162 x 370)_value});"> 
    <div class="slide-video"> 
    <video id="my_video_1" class="video-js vjs-default-skin" controls 
preload="auto" width="380" height="240" poster="{tag_Video Thumbnail (380 x 240)_value}" 
data-setup="{}"> 
     <source src="{tag_Video URL}" type='video/mp4'> 
    </video> 
    </div> 
    <div class="slide-text-wrapper"> 
    <div class="slide-text" style="width: {tag_text width (pixels)}px;"> 
     <p>{tag_description}</p> 
     <p><a class="slide-button" href="{tag_Button URL}">{tag_Button Text}</a></p> 
    </div> 
    </div> 
</div> 

編輯下面的jQuery的似乎是工作以外的事件偵聽器的罰款。函數pauseSlideshow正常運行,但不會等待我點擊播放,它只會自動運行。

_V_("my_video_1").ready(function(){ 
    var myPlayer = this; 
    function pauseSlideshow(){ 
     $('.cycle-slideshow').cycle('pause'); 
     $('.slideshow-button').addClass('play'); 
     } 
    myPlayer.addEvent("play", pauseSlideshow()); 
}); 

感謝您的幫助,

傑夫

回答

0

好吧,我終於想通了什麼事。我沒有使用適當的語法。

這裏是我找到了解決辦法:

// Pause slideshow on play 
_V_("my_video_1").ready(function(){ 
    var myPlayer = this; 
    function pauseSlideshow(){ 
    $('.cycle-slideshow').cycle('pause'); 
    $('.slideshow-button').addClass('play'); 
    } 
    myPlayer.on("play", pauseSlideshow); 
});