/*-------------------产品列表页----------------*/ function set_pro_roll(id, blen, slen, x) {//列表框id、blen列表框单个长度、slen、当前显示多少条 var _this = this; var count = x ? x : 1; //每次跳跃几张 blen = blen * count; var box = $("#" + id); var a = box.find("a"); var len = a.length; var bg = 0, t = 0, n = 0, gleft = 0; var isroll = false; _this.isRight = true; var roll = function () { isroll = true; n += 4; t += 4 + n; if (t >= blen) { t = blen; n = 0; isroll = false; clearInterval(k); } if (t >= blen/2) { n -= 4; } gleft = bg + (_this.isRight ? (t) : (-(t))); box.css("left", gleft + "px"); } var k; set_pro_roll.prototype._roll = function () { roll(); }; var rollTime = 10; //可以判断是否ie ie的话设置10比较快点 $("span.prev_btn").click(function () {//左按钮 if (!isroll) { bg = parseInt(box.css("left")); if (bg < 0) { t = 0; _this.isRight = true; k = setInterval(roll, rollTime); } else { // alert("已经是首张"); } } }); $("span.next_btn").click(function () {//右按钮 if (!isroll) { bg = parseInt(box.css("left")); if (bg + (len - slen) * blen > 0) { t = 0; _this.isRight = false; k = setInterval(roll, rollTime); } else { // alert("已经到末张"); } } }); checkCurrent(); } function checkCurrent() { //初始化---------判断上面两个按钮-------当前a是第一个的话:pre按钮不显示。当前a是最后一个的话next按钮不显示 var l_pre = $("div.scroll_pics a.currentPic").prev("a").length; $("span.bigic_prev").css("display", l_pre == 0 ? "none" : "inline-block"); var l_next = $("div.scroll_pics a.currentPic").next("a").length; $("span.bigic_next").css("display", l_next == 0 ? "none" : "inline-block"); } $(document).ready(function () { var setr = new set_pro_roll("scroll_pics_in", 105, 5); var aos = $("div.scroll_pics a"); $("#scroll_pics_in").width(106 * aos.length + "px"); $(aos).each(function (i) { $(this).click(function () { var _this = this; $("div.scroll_pics a").removeClass("currentPic"); $(_this).addClass("currentPic"); $("#show_big_img img").fadeTo("fast", 0.2, function () { //alert($(_this).attr("bigimg")); $(this).attr("src", $(_this).attr("bigimg")); $(this).fadeTo("fast", 1, null); $("div#big_desc").html($(_this).attr("remark")); }); checkCurrent(); var lef = $(_this).offset().left; // alert(lef); if (lef < 623) {//向右移 $("span.prev_btn").click(); } else if (lef > 623) { $("span.next_btn").click(); } }); }); $("span.bigic_prev").click(function () { var _this = $("div.scroll_pics a.currentPic").prev("a"); if (_this.length > 0) { _this.click(); } else { alert("已到达首张!"); } }); $("span.bigic_next").click(function () { var _a = $("div.scroll_pics a"); if (_a.length > 1) { var _b = $("div.scroll_pics a.currentPic"); _this = _b.length > 0 ? $("div.scroll_pics a.currentPic").next("a") : $(_a[1]); if (_this.length > 0) { _this.click(); } else { alert("已到达末张!"); } } }); });

ag九游会登陆

2012WEC回顾
当前位置:ag九游会登陆>精彩瞬间>精彩图集
2012WEC回顾