0

我有一个<div>列表(ul,li)。

我想要一个 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();

});
4

1 回答 1

0

我想你正在寻找这样的东西。我不知道有什么插件可以做到这一点,但使用动画回调很容易编写自己的代码。

http://jsfiddle.net/ABAEE/

$('span').animate( {marginLeft:0}, 1500, 'swing', function() {
    $(this).delay(2000).animate( {marginLeft:250}, 1500, 'swing');
});
于 2012-11-03T04:38:26.267 回答