2015-02-09 121 views
0

我對動畫背景使用以下腳本,現在圖片淡入淡出,但我希望它們水平向左滑動。在jquery中水平滑換幻燈片

我的問題是,這是一個標準的jQuery「功能」,因爲我很難找到正確的方法來做到這一點。

是否有人能夠幫助我修改我的代碼,使其符合我的要求?

在此先感謝。我使用

代碼:

$(function(){ 
    $('#background img:gt(0)').hide(); 
    setInterval(function(){ 
     $('#background :first-child').fadeOut() 
     .next('img').fadeIn() 
     .end().appendTo('#background');}, 
     3000); 
}); 
+0

使用'.animate()' – Alex 2015-02-09 15:18:26

+0

將'vertical'向左滑動?你的意思是水平嗎? – 2015-02-09 15:34:33

+1

@讓 - 保羅...是水平,現在我覺得很愚蠢 – Snowlav 2015-02-09 17:14:59

回答

0

您可以使用jQuery .animate()到水平切換。例如:

$('#background :first-child').animate({width: 'toggle'}) 
    .next('img').animate({width: 'toggle'}) 
    .end().appendTo('#background');}, 
    3000);