点击左右滚动
function zjrolling(rid) {
	
    var id = "#" + rid,
    len = $('.cont_roll', id).children().length,
    width = 0,
    autoroll;
    for (var j = 0; j < len; j++) { $('.cont_roll a', id).eq(j).children("img").attr('alt', j); } for (var i = len - 1; i >= 0; i--) {
        width += $('.cont_roll', id).children().eq(i).outerWidth(true);
    }
    $('.cont_roll', id).width(width);
    $('.cont_roll a', id).eq(0).addClass("select");
	
    $('.cont_roll a', id).hover(function() {
        $(this).addClass("select").siblings().removeClass();
        var aIndex = $('.cont_roll a.select', id).children("img").attr("alt");
    });
	
    $(id).hover(function() {
        clearInterval(autoroll);
        return false;
    },
    function() {
        autoroll = setInterval(roll_left = function() {
            var mleft = $(id + ' .cont_roll').children().first().outerWidth(true);
            $(id + ' .cont_roll').animate({
                marginLeft: "-=" + mleft
            },
            320,
            function() {
                $('.cont_roll', id).children().first().appendTo($('.cont_roll', id)).parent().css("marginLeft", 0);

                $('.cont_roll a', id).eq(0).addClass("select").siblings().removeClass("select");
               
            });
        },
        4000);
    }).trigger("mouseout");
    $(".prev", id).click(function() {
        var mleft = $(id + ' .cont_roll').children().first().outerWidth(true);
		
        $(id + ' .cont_roll').animate({
            marginLeft: "-=" + mleft
        },
        320,
        function() {
            $('.cont_roll', id).children().first().appendTo($('.cont_roll', id)).parent().css("marginLeft", 0);

            $('.cont_roll a', id).eq(0).addClass("select").siblings().removeClass("select");
            
        });	
		
    });
    $(".next", id).click(function() {
        var mleft = $('.cont_roll', id).children().last().outerWidth(true);


        $('.cont_roll', id).css("marginLeft", "-" + mleft + "px").prepend($('.cont_roll', id).children().last()).animate({
            marginLeft: "+=" + mleft
        },
        320);

        $('.cont_roll a', id).eq(0).addClass("select").siblings().removeClass("select");
        
    });
}

点击左右滚动实例下载