2012-11-03 39 views
0

我有一個<div>與列表(ul,li)。jquery滾動文本與中間暫停

我想要一個jquery插件,在<div>的中間幾秒鐘內從左側快速執行文本滾動並暫停。然後文本向右滾動並消失。

你有插件名嗎?

謝謝。

編輯: 在mrtsherman的幫助下,我成功地創建了腳本。 有解決方案:

$(document).ready(function() { 
    $('#affichage_titreSemaine > span').css('opacity', '0'); 

    function TitresSemaine() { 
     // get the item that currently has the 'show' class 
     var current = $('#affichage_titreSemaine .show'); 

     var next = current.next().length ? current.next() : $('#affichage_titreSemaine span :first'); 
     // fade out the current item and remove the 'show' class 
     current.animate({opacity: "1.0", marginLeft: 465 - (current.width())/2}, 500, 'swing'); 
     current.delay(2000).animate({opacity: "0.0", marginLeft: 930 - current.width()}, 500, 'swing', function(){ 
      $(this).animate({marginLeft : 0}, 10, 'swing'); 
      $(this).hide(); 
      next.addClass("show"); 
      next.show(); 
     }).removeClass("show"); 

     // repeat by calling the textloop method again after 3 seconds 
     setTimeout(TitresSemaine,4000); 
    } 

    TitresSemaine(); 

}); 
+0

這是一個水平滾動列表?你能發表一個你想要的例子的鏈接,或者至少是你想要的東西嗎?你的描述很難被忽略。 – mrtsherman

+0

我會盡力找到一個例子,在行動中,我看到了,但我忘了鏈接。 這是一個水平滾動,像html ,但它停在容器中間幾秒鐘後重新啓動。 文字從左側快速到達,在中間停頓幾秒鐘,然後向右走,消失。 – Warks

回答

0

我認爲你正在尋找這樣的事情。我不知道有這樣一個插件,但使用動畫回調編碼很容易。

http://jsfiddle.net/ABaEE/

$('span').animate({marginLeft:0}, 1500, 'swing', function() { 
    $(this).delay(2000).animate({marginLeft:250}, 1500, 'swing'); 
}); 
+0

謝謝,可能會做無限循環? (請參閱我的下一個答案) – Warks