原文复制三边,用animate跑,每次跑1/3,然后用css(‘left’,reset) 移动位置,其他就不多解释了。

var scroller = $(‘#rtext’),html = scroller.html(),scrollInterval = -1,scrollTime = 30000,reset = 0;
scroller.html( html + html + html);
scrollInterval = window.setInterval(function(){
    scroll(true);
},scrollTime/4);

function scroll(){
    scroller.css({‘left’:reset}).stop().animate({‘left’:"-="+scroller.width()/3},scrollTime/3,’linear’);
}

scroller.css(‘width’,'auto’).hover(function(){
    $(‘#rtext’).stop();
    scrollInterval = window.clearInterval(scrollInterval);
},function(){
    scrollInterval = window.clearInterval(scrollInterval);
    scrollInterval = window.setInterval(function(){
        scroll();
    },scrollTime/3);
    scroller.stop().animate({‘left’:"-="+scroller.width()/3},scrollTime/3,’linear’);
    if(parseInt(scroller.css(‘left’)) < – scroller.width()/3){
        reset = parseInt(scroller.css(‘left’)) + scroller.width()/3;
    }else{
        reset = parseInt(scroller.css(‘left’));
    }
});
scroll();

« »