开启懒人模式下完,发现代码写法有些蛋疼- - 稍微修改了下,希望帮到大家(根据项目需求做了些变动)
    var _index=1;
    var length = $(".flashBg ul.mobile li").length;
    var htmlContent = $("ul.mobile").html();
    $(document).on("click",".mobile li",function(){
        var index = $(this).index();
        if(index > _index){
            _index++;
            var len=$(".flashBg ul.mobile li").length;
            if(_index+length-1>len){
                $("#four_flash .flashBg ul.mobile").stop().append(htmlContent);
            }
            $("#four_flash .flashBg ul.mobile").stop().animate({left:-(_index-1)*387},1000);
        }else if(index < _index){
            if(_index==1){
                _index = length;
                $("#four_flash .flashBg ul.mobile").css({left:-(_index)*387});
                $("#four_flash .flashBg ul.mobile").stop().animate({left:-(_index-1)*387},1000);
                $("ul.mobile").prepend(htmlContent);
                $(".flashBg ul.mobile li").eq(_index).addClass("current").siblings().removeClass("current");
                return;
            }
            _index--;
            $("#four_flash .flashBg ul.mobile").stop().animate({left:-(_index-1)*387},1000);   
        }
        $(".flashBg ul.mobile li").eq(_index).addClass("current").siblings().removeClass("current");
    });