function lbmove(boxid, btn_left, btn_right, btnbox, car, direction, way, movelengh, speed, interval, number) { var _id = $("#" + boxid + ""); var _btn_left = $("#" + btn_left + ""); var _btn_right = $("#" + btn_right + ""); var _btnbox = $("#" + btnbox + ""); var jsq = 0 var timer; var cj; var no_way = 0; var no_wayget = 0; var fade = 0; var new_time = new date; var id_lilen, id_liheight, cbtmbtn; id_lilen = _id.find("li").length; id_liheight = _id.find("li").innerheight(); if (direction == "left" || direction == "right") { _id.find("ul").width(id_lilen * movelengh); } else if (direction == "top" || direction == "bottom") { _id.find("ul").height(id_lilen * movelengh); _btnbox.hide() } else if (direction == "fade") { _id.find("ul").width(movelengh).height(id_liheight); _id.find("li").eq(0).show().siblings().hide(); _id.find("li").css({ "position": "absolute", "left": 0, "top": 0 }); } _btnbox.empty(); for (i = 0; i < id_lilen; i++) { _btnbox.append(""); }; _btnbox.find("span").eq(0).addclass("cur"); if (way == false) { _btn_left.hide(); _btn_right.hide(); _btnbox.hide(); } function carousel() { if (way == false) { no_way++; if (direction == "left") { _id.find("ul").css({ "left": -no_way }); no_wayget = parseint(_id.find("ul").css("left")); if (no_wayget == -movelengh) { no_way = 0 _id.find("li:first").insertafter(_id.find("li:last")); _id.find("ul").css({ "left": 0 }); } } if (direction == "right") { no_wayget = parseint(_id.find("ul").css("left")); if (no_wayget == 0) { no_way = -movelengh _id.find("li:last").insertbefore(_id.find("li:first")); _id.find("ul").css({ "left": 0 }); } _id.find("ul").css({ "left": no_way }); } if (direction == "top") { _id.find("ul").css({ "top": -no_way }); no_wayget = parseint(_id.find("ul").css("top")); if (no_wayget == -movelengh) { no_way = 0 _id.find("li:first").insertafter(_id.find("li:last")); _id.find("ul").css({ "top": 0 }); } } if (direction == "bottom") { no_wayget = parseint(_id.find("ul").css("top")); if (no_wayget == 0) { no_way = -movelengh _id.find("li:last").insertbefore(_id.find("li:first")); _id.find("ul").css({ "top": 0 }); } _id.find("ul").css({ "top": no_way }); } } else if (way == true) { if (direction == "left") { _id.find("ul").animate({ left: -movelengh }, speed, function() { _id.find("li:first").insertafter(_id.find("li:last")); _id.find("ul").css({ "left": 0 }); }); if (jsq < id_lilen - 1) { jsq++; _btnbox.find("span").eq(jsq).addclass("cur").siblings().removeclass("cur"); } else { jsq = 0; _btnbox.find("span").eq(jsq).addclass("cur").siblings().removeclass("cur"); } } if (direction == "right") { _id.find("li:last").insertbefore(_id.find("li:first")); _id.find("ul").css({ "left": -movelengh }); _id.find("ul").stop().animate({ left: 0 }, speed); if (jsq > 0) { jsq--; _btnbox.find("span").eq(jsq).addclass("cur").siblings().removeclass("cur"); } else { jsq = id_lilen - 1; _btnbox.find("span").eq(jsq).addclass("cur").siblings().removeclass("cur"); } } if (direction == "top") { _id.find("ul").animate({ top: -movelengh }, speed, function() { _id.find("li:first").insertafter(_id.find("li:last")); _id.find("ul").css({ "top": 0 }); }); } if (direction == "bottom") { _id.find("li:last").insertbefore(_id.find("li:first")); _id.find("ul").css({ "top": -movelengh }); _id.find("ul").stop().animate({ top: 0 }, speed); } if (direction == "fade") { if (fade < id_lilen - 1) { fade++; } else { fade = 0 } _id.find("li").eq(fade).fadein(speed).siblings().fadeout(speed); _btnbox.find("span").eq(fade).addclass("cur").siblings().removeclass("cur"); } } } if (car == true) { if (id_lilen > number) { timer = setinterval(carousel, interval); } else { clearinterval(timer); _btn_left.hide(); _btn_right.hide(); _btnbox.hide(); } } else { clearinterval(timer); } _id.find("li").hover(function() { clearinterval(timer); }, function() { if (car == true) { if (id_lilen > number) { timer = setinterval(carousel, interval); } else { clearinterval(timer); _btn_left.hide(); _btn_right.hide(); _btnbox.hide(); } } else { clearinterval(timer); } }); _btn_right.hover(function() { clearinterval(timer); }, function() { if (car == true) { if (id_lilen > number) { timer = setinterval(carousel, interval); } else { clearinterval(timer); _btn_left.hide(); _btn_right.hide(); _btnbox.hide(); } } else { clearinterval(timer); } }).click(function() { if (new date - new_time > 500) { new_time = new date; if (direction == "left" || direction == "right") { _id.find("ul").animate({ left: -movelengh }, speed, function() { _id.find("li:first").insertafter(_id.find("li:last")); _id.find("ul").css({ "left": 0 }); }); } if (direction == "top" || direction == "bottom") { _id.find("ul").animate({ top: -movelengh }, speed, function() { _id.find("li:first").insertafter(_id.find("li:last")); _id.find("ul").css({ "top": 0 }); }); } if (direction == "fade") { if (fade > 0) { fade--; } else { fade = id_lilen - 1 } _id.find("li").stop(true, true).eq(fade).fadein(speed).siblings().fadeout(speed); } if (jsq < id_lilen - 1) { jsq++; _btnbox.find("span").eq(jsq).addclass("cur").siblings().removeclass("cur"); } else { jsq = 0; _btnbox.find("span").eq(jsq).addclass("cur").siblings().removeclass("cur"); }; } else {}; }); _btn_left.hover(function() { clearinterval(timer); }, function() { if (car == true) { if (id_lilen > number) { timer = setinterval(carousel, interval); } else { clearinterval(timer); _btn_left.hide(); _btn_right.hide(); _btnbox.hide(); } } else { clearinterval(timer); } }).click(function() { if (new date - new_time > 500) { new_time = new date; if (direction == "left" || direction == "right") { _id.find("li:last").insertbefore(_id.find("li:first")); _id.find("ul").css({ "left": -movelengh }); _id.find("ul").stop().animate({ left: 0 }, speed); } if (direction == "top" || direction == "bottom") { _id.find("li:last").insertbefore(_id.find("li:first")); _id.find("ul").css({ "top": -movelengh }); _id.find("ul").stop().animate({ top: 0 }, speed); } if (direction == "fade") { if (fade < id_lilen - 1) { fade++; } else { fade = 0 } _id.find("li").stop(true, true).eq(fade).fadein(speed).siblings().fadeout(speed); } if (jsq > 0) { jsq--; _btnbox.find("span").eq(jsq).addclass("cur").siblings().removeclass("cur"); } else { jsq = id_lilen - 1; _btnbox.find("span").eq(jsq).addclass("cur").siblings().removeclass("cur"); }; } else {}; }); _btnbox.find("span").hover(function() { clearinterval(timer); }, function() { if (car == true) { if (id_lilen > number) { timer = setinterval(carousel, interval); } else { clearinterval(timer); _btn_left.hide(); _btn_right.hide(); _btnbox.hide(); } } else { clearinterval(timer); } }).click(function() { if (new date - new_time > 500) { new_time = new date; cbtmbtn = $(this).index(); $(this).addclass("cur").siblings().removeclass("cur"); if (direction == "fade") { _id.find("li").eq(cbtmbtn).fadein(speed).siblings().fadeout(speed); } else { if (cbtmbtn > jsq) { cj = cbtmbtn - jsq; jsq = cbtmbtn; _id.find("ul").stop().animate({ left: -movelengh * cj }, speed, function() { for (i = 0; i < cj; i++) { _id.find("ul").css({ "left": 0 }) _id.find("li:first").insertafter(_id.find("li:last")); }; }); } else { cj = jsq - cbtmbtn; jsq = cbtmbtn; _id.find("ul").css({ "left": -movelengh * cj }); for (i = 0; i < cj; i++) { _id.find("ul").stop().animate({ left: 0 }, speed); _id.find("li:last").insertbefore(_id.find("li:first")); }; }; }; } else {}; }); }