2012-11-03 38 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