2012-11-23 128 views
1

我有一個自動播放的問題,當滑動到最後,我想再次去第一,在這個幻燈片自動播放:的jQuery - 混凝土幻燈片

jQuery Slideshow

我試着使用這個功能,但是這不能幫助我:

$('#slideshow').slide({ 
    extend: function() { 
     this.play(1000); 
    } 
}); 

也:

setInterval(function(){ ... }, 3000); 

謝謝大家的幫助

+0

您是否嘗試過此頁面的評論中的修改版本? http://sixrevisions.com/tutorials/javascript_tutorial/create-a-slick-and-accessible-slideshow-using-jquery/#comment-40273 –

回答

0

我已經研究了一些控件類中的代碼,您已經綁定了單擊事件。所以通過從中獲取代碼將其添加到函數中,然後在一段時間後調用它將使滑塊自動工作。代碼將是這樣的:

function slideme(position) 
{ 
    currentPosition = (position=='right') ? currentPosition+1 : currentPosition-1; 
    // Hide/show controls 
    manageControls(currentPosition); 
    // Move slideInner using margin-left 
    $('#slideInner').animate({ 
     'marginLeft' : slideWidth*(-currentPosition) 
    }); 
} 

//on document ready 
$(function(){    
     slideme('left'); 
     //Add Some intervals 
     slideme('left'); 
     //Add Some intervals 
     slideme('left'); 
     //Add Some intervals 
     slideme('left'); 
     //Add Some intervals 
     slideme('right'); 

     //all above you can write in loops by getting total no of slides dynamically   
});