/*jQuery.fn.extend({ pictureShows : function() { return this.each(function() { this.checked = true; alert(jQuery(this).attr("id")); }); } });*/ var pictureBlo = true; var pictureTimer = null; function pictureShows(name, type, arrow, auto_play, speed, dot, thum, control, thum_num, moveSpeed, pictureCount) { this.pictureCount = pictureCount; this.name = name; this.type = type; this.arrow = arrow; this.auto_play = auto_play; this.speed = speed; this.dot = dot; this.thum = thum; this.control = control; this.thum_num = thum_num; this.moveSpeed = moveSpeed; this.init(this.name, this.type, this.arrow, this.auto_play, this.speed, this.dot, this.thum, this.control, this.thum_num, this.moveSpeed, this.pictureCount); } pictureShows.prototype.init = function (name, type, arrow, auto_play, speed, dot, thum, control, thum_num, moveSpeed, pictureCount) { pictureShows.prototype.showType(name, type, arrow, dot, thum, control, thum_num, moveSpeed, pictureCount); pictureShows.prototype.control(name, type, control, thum_num, moveSpeed, pictureCount); pictureShows.prototype.arrow(name, type, arrow, thum_num, moveSpeed, pictureCount); pictureShows.prototype.auto(name, type, auto_play, speed, thum_num, moveSpeed, pictureCount); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); } //切换模式 pictureShows.prototype.showType = function (name, type, arrow, dot, thum, control, thum_num, moveSpeed, pictureCount) { var _this = jQuery("." + name), banner_size = _this.find("ul li").size(); var typeStrs = type.split("_"); if (typeStrs[0] == "stack") { _this.addClass("stack").addClass(type); var stackNum = Number(typeStrs[1]); var paraStackLeft = Number(typeStrs[2]) / 10; } else { _this.addClass(type); } if (typeStrs[0] == "stack2") { _this.addClass("stack2").addClass(type); var stackNum2 = Number(typeStrs[1]); var paraStackLeft2 = Number(typeStrs[2]); var paraStackLeft3 = Number(typeStrs[3]) / 10; _this.parent().find(".picture_box ul li:eq(" + Math.ceil(stackNum2 / 2 - 1) + ") p").show(); _this.parent().find(".picture_box ul li:eq(" + Math.ceil(stackNum2 / 2 - 1) + ") p").parent().siblings().find("p").hide(); } else { _this.addClass(type); } //点按钮判断 if (dot == true) { for (var createSpan = 0; createSpan < banner_size; createSpan++) { _this.find(".dlWrap").append(""); } } else { _this.parent().find(".dlWrap").remove(); } //缩略图判断 if (typeof thum_num != "number" || thum_num == 0 || thum == false) { _this.parent().find(".picture_thum_wrap").remove(); _this.parent().find(".pic_scroll_hand").remove(); } else if (typeof thum_num == "number" || thum_num > 0 || thum == true) { var _this = jQuery("." + name), banner_size = _this.find("ul li").size(); var thumGroup = Math.ceil(banner_size / thum_num); var margR1 = Number(_this.parent().find(".picture_thum_box li:eq(" + 0 + ")").css("marginRight").replace('px', '')); var marR1Length = margR1 * thum_num; _this.parent().find(".picture_thum_box ul li").css({ "width": ((Math.ceil(_this.parent().find(".picture_thum_wrap").width() - marR1Length + margR1) / thum_num)) }) _this.parent().find(".picture_thum_wrap").fadeIn(); } jQuery(".picture_tit").html(_this.parent().find(".picture_box ul li:eq(" + pictureCount + ") img").attr("data-tit")); jQuery(".picture_tit").html(_this.parent().find(".picture_thum_box ul li:eq(" + pictureCount + ") img").attr("data-tit")); //进度滚动条 if (control == "cancel") { _this.parent().find(".pic_scroll_hand").remove(); } else if (control == "scroll" || control == "scroll_and_sj") { if (_this.parent().find(".picture_thum_box ul li").size() <= thum_num) { _this.parent().find(".pic_scroll_hand span").width("100%"); } else { _this.parent().find(".pic_scroll_hand span").width(_this.parent().find(".pic_scroll_hand").width() / (banner_size / 1.5)); } _this.parent().find(".pic_scroll_hand").show(); } else if (control == "scroll_arrow") { } //左右箭头判断 if ((arrow == true) || (control == "scroll_and_sj" || control == "scroll_arrow")) { if (arrow == true) { _this.parent().append(''); _this.parent().append(''); } if (control == "scroll_and_sj" || control == "scroll_arrow") { _this.parent().find(".picture_thum_wrap").append(''); _this.parent().find(".picture_thum_wrap").append(''); } var leftMenu = _this.parent().find(".picture_arrow_left,.picture_thum_left"); var rightMenu = _this.parent().find(".picture_arrow_right,.picture_thum_right"); //缩略图位置判断方法 if (typeStrs[0] == "stack2") { } else { leftMenu.addClass('active') } leftMenu.on("click", function () { rightMenu.removeClass('active'); if (!_this.find("ul").is(":animated") && !_this.find("ul li").is(":animated")) { if (typeStrs[0] == "stack2") { if (pictureCount <= Math.ceil((0 - typeStrs[1]) / 2) + 1) { leftMenu.addClass('active'); } if (pictureCount <= Math.ceil((0 - typeStrs[1]) / 2)) { } else { pictureCount--; pictureShows.prototype.showMove(name, type, pictureCount, "left", moveSpeed, pictureCount); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureShows.prototype.arrow(name, type, arrow, thum_num, moveSpeed, pictureCount) } }else if(typeStrs[0] == "slide"){ if (pictureCount <= 0) { pictureCount = banner_size - 1; pictureShows.prototype.showMove(name, type, pictureCount, "left", moveSpeed, pictureCount); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureShows.prototype.arrow(name, type, arrow, thum_num, moveSpeed, pictureCount); } else { pictureCount--; pictureShows.prototype.showMove(name, type, pictureCount, "left", moveSpeed, pictureCount); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureShows.prototype.arrow(name, type, arrow, thum_num, moveSpeed, pictureCount) } }else { if (pictureCount <= 1) { leftMenu.addClass('active'); } if (pictureCount <= 0) { } else { pictureCount--; pictureShows.prototype.showMove(name, type, pictureCount, "left", moveSpeed, pictureCount); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureShows.prototype.arrow(name, type, arrow, thum_num, moveSpeed, pictureCount) } } } }) rightMenu.on("click", function () { leftMenu.removeClass('active'); var numPut = (banner_size - 1) + Math.ceil((0 - typeStrs[1]) / 2); if (!_this.find("ul").is(":animated") && !_this.find("ul li").is(":animated")) { if (typeStrs[0] == "stack2") { if (pictureCount >= numPut - 1) { rightMenu.addClass('active'); } if (pictureCount >= numPut) { } else { pictureCount++; pictureShows.prototype.showMove(name, type, pictureCount, "right", moveSpeed, pictureCount); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureShows.prototype.arrow(name, type, arrow, thum_num, moveSpeed, pictureCount) } } else if (typeStrs[0] == "slide") { if (pictureCount >= banner_size - 1) { pictureCount = 0; pictureShows.prototype.showMove(name, type, pictureCount, "right", moveSpeed, pictureCount); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureShows.prototype.arrow(name, type, arrow, thum_num, moveSpeed, pictureCount); } else { pictureCount++; pictureShows.prototype.showMove(name, type, pictureCount, "right", moveSpeed, pictureCount); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureShows.prototype.arrow(name, type, arrow, thum_num, moveSpeed, pictureCount) } } else { if (pictureCount >= banner_size - 2) { rightMenu.addClass('active'); } if (pictureCount >= banner_size - 1) { } else { pictureCount++; pictureShows.prototype.showMove(name, type, pictureCount, "right", moveSpeed, pictureCount); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureShows.prototype.arrow(name, type, arrow, thum_num, moveSpeed, pictureCount) } } } }) } _this.find(".dlWrap span:eq(0)").removeClass().addClass("active").siblings().removeClass(); _this.parent().find(".picture_text font").text(1); _this.parent().find(".picture_text span").text(banner_size); //渐变运动方法 function opacity_move(_this, nIndex) { if (!_this.find("li").is(":animated")) { _this.find("li").eq(nIndex).fadeIn().siblings().fadeOut(); _this.find("li").eq(nIndex).css("zIndex", 2).siblings().css("zIndex", 1); _this.parent().find(".picture_text font").text(nIndex + 1); _this.parent().find(".pic_top > div:eq(" + nIndex + ")").show().siblings().hide(); _this.find(".dlWrap span:eq(" + nIndex + ")").removeClass().addClass("active").siblings().removeClass(); pictureCount = nIndex; } } function side_move(_this, nIndex) { var margR = Number(_this.parent().find(".picture_box li:eq(" + 0 + ")").css("marginRight").replace('px', '')); var margA = _this.find("li:eq(0)").width() + margR; if (!_this.find("ul").is(":animated")) { _this.find("ul").stop().animate({ "left": -1 * margA * nIndex + (_this.width() / 2 - _this.find("li:eq(0)").width() / 2) }, { easing: 'easeInOutQuad', duration: moveSpeed }); } } //滑动运动方法 function slide_move(_this, nIndex) { if (!_this.find("ul").is(":animated")) { if (nIndex > pictureCount) { _this.find("li").eq(nIndex).css("left", _this.width()); _this.find("ul").stop().animate({ "left": -1 * _this.width() }, { easing: 'easeInOutQuad', duration: moveSpeed, complete: function () { _this.find("li").eq(nIndex).addClass("active").siblings().removeClass(); _this.find("ul").css("left", 0); _this.find("li").css("left", 0); } }); } else if (nIndex < pictureCount) { _this.find("li").eq(nIndex).css("left", _this.width() * -1); _this.find("ul").stop().animate({ "left": _this.width() }, { easing: 'easeInOutQuad', duration: moveSpeed, complete: function () { _this.find("li").eq(nIndex).addClass("active").siblings().removeClass(); _this.find("ul").css("left", 0); _this.find("li").css("left", 0); } }); } _this.parent().find(".picture_text font").text(nIndex + 1); _this.parent().find(".pic_top > div:eq(" + nIndex + ")").show().siblings().hide(); _this.find(".dlWrap span:eq(" + nIndex + ")").removeClass().addClass("active").siblings().removeClass(); pictureCount = nIndex; pictureShows.prototype.arrow(name, type, arrow, thum_num, moveSpeed, pictureCount); pictureBlo = false; //alert(pictureCount) } } //层叠滑动 function stack_move(_this, nIndex) { if (!_this.find("ul").is(":animated")) { var getStackLiWidth = _this.find("li.active").width(); var getStackLiHeight = _this.find("li.active").width(); var stackEve = nIndex + stackNum; var paraStackWidth = 0.9; var indexTop = 2000; //alert(getStackLiWidth+","+getStackLiHeight); var wxSum = 0; //for(var j=pictureCount+1; j pictureCount) { for (var j = nIndex; j <= i - 2; j++) { wxSum += beforeStackli.width() * Math.pow(paraStackWidth, stackCount) * paraStackLeft + beforeStackli.width() * 0.04; } _this.find("li").eq(i).css("zIndex", indexTop - i); _this.find("li").eq(i).stop().animate({ "width": beforeStackli.width() * Math.pow(paraStackWidth, stackCount - 1), "height": beforeStackli.height() * Math.pow(paraStackWidth, stackCount - 1), "left": paraLeftMX + wxSum, "top": beforeStackli.position().top + beforeStackli.height() * 0.5 - beforeStackli.height() * Math.pow(paraStackWidth, stackCount - 1) / 2 }, moveSpeed); } else { for (var j = nIndex; j <= i - 2; j++) { wxSum += beforeStackli.width() * Math.pow(paraStackWidth, stackCount) * paraStackLeft + beforeStackli.width() * 0.04; } _this.find("li").eq(i).css("zIndex", indexTop - i); _this.find("li").eq(i).stop().animate({ "width": beforeStackli.width() * Math.pow(paraStackWidth, stackCount - 1), "height": beforeStackli.height() * Math.pow(paraStackWidth, stackCount - 1), "left": paraLeftMX + wxSum, "top": beforeStackli.position().top + beforeStackli.height() * 0.5 - beforeStackli.height() * Math.pow(paraStackWidth, stackCount - 1) / 2 }, moveSpeed); } } } _this.find("li").eq(nIndex).removeClass().addClass("active").siblings().removeClass(); _this.parent().find(".picture_text font").text(nIndex + 1); _this.parent().find(".pic_top > div:eq(" + nIndex + ")").show().siblings().hide(); _this.find(".dlWrap span:eq(" + nIndex + ")").removeClass().addClass("active").siblings().removeClass(); pictureCount = nIndex; pictureShows.prototype.arrow(name, type, arrow, thum_num, moveSpeed, pictureCount); pictureBlo = false; } } function stack_move2(_this, nIndex) { if(!$("#picture_wrap li").is(":animated")){ var stack2Count = stackNum2; var theActive = Math.floor(stack2Count / 2); var zIndexStack2 = nIndex + theActive - 1; var theCha = (nIndex - pictureCount) - 1; _this.find("li").eq(zIndexStack2 - theCha).addClass("active"); _this.find("li").eq(zIndexStack2 - theCha).siblings().removeClass("active"); _this.parent().find(".picture_box ul li:eq(" + Math.ceil(stackNum2 / 2) + ") p").show(); _this.parent().find(".picture_box ul li:eq(" + Math.ceil(stackNum2 / 2) + ") p").parent().siblings().find("p").hide(); var getStackLiWidth = _this.find("li.active").width(); var getStackLiHeight = _this.find("li.active").height(); var getStackLiLeft = _this.find("li.active").position().left; var getStackLiTop = _this.find("li.active").position().top; var stack2Compare = paraStackLeft3; var stack2Compare_left = 0.2; //alert(zIndexStack2+1) _this.find("li").css({ "zIndex": 1 }); _this.find("li").stop().animate({ "width": getStackLiWidth * Math.pow(stack2Compare, theActive) / 2, "height": ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, theActive) / 2)) * stack2Compare) / getStackLiWidth * getStackLiHeight, "left": getStackLiLeft + getStackLiWidth * Math.pow(stack2Compare, theActive) / 2 / 2, "top": getStackLiTop + ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, theActive) / 2)) * stack2Compare) / getStackLiWidth * getStackLiHeight / 2 }, moveSpeed); if (nIndex > pictureCount) { for (var i = zIndexStack2 - (Math.floor(stack2Count / 2) - 1) ; i <= zIndexStack2 + (stack2Count - (Math.floor(stack2Count / 2))) ; i++) { if (i == zIndexStack2 + 1) { //alert(getStackLiWidth) _this.find("li").eq(i).css({ "zIndex": 300 }) _this.find("li").eq(i).stop().animate({ "width": getStackLiWidth, "height": getStackLiHeight, "left": getStackLiLeft, "top": getStackLiTop, "zIndex": 300 }, moveSpeed); } else if (i < zIndexStack2 + 1) { _this.find("li").eq(i).css({ "zIndex": i }); _this.find("li").eq(i).stop().animate({ "width": getStackLiWidth * Math.pow(stack2Compare, zIndexStack2 + 1 - i), "height": ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, zIndexStack2 - i))) * stack2Compare) / getStackLiWidth * getStackLiHeight, "left": _this.find("li").eq(i - theCha).position().left - paraStackLeft2, "marginLeft": 0, "top": _this.find("li.active").position().top + _this.find("li.active").height() / 2 - ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, zIndexStack2 - i))) * stack2Compare) / getStackLiWidth * getStackLiHeight / 2 }, moveSpeed); } else if (i > zIndexStack2 + 1) { //alert(zIndexStack2) _this.find("li").eq(i).css({ "zIndex": banner_size - i }); _this.find("li").eq(i).stop().animate({ "width": getStackLiWidth * Math.pow(stack2Compare, (zIndexStack2 - (i - 1)) * -1), "height": ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, (zIndexStack2 - (i - 1)) * -1)))) / getStackLiWidth * getStackLiHeight, "marginLeft": 0, "top": _this.find("li.active").position().top + _this.find("li.active").height() / 2 - ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, (zIndexStack2 - (i - 1)) * -1)))) / getStackLiWidth * getStackLiHeight / 2, "left": _this.find("li").eq(i - theCha - 1).position().left }, moveSpeed); } } } else if (nIndex < pictureCount) { //alert(getStackLiWidth) for (var i = zIndexStack2 - (Math.floor(stack2Count / 2) - 1) ; i <= zIndexStack2 + (stack2Count - (Math.floor(stack2Count / 2))) ; i++) { if (i == zIndexStack2 + 1) { //alert(i) _this.find("li").eq(i).css({ "zIndex": 300 }) _this.find("li").eq(i).stop().animate({ "width": getStackLiWidth, "height": getStackLiHeight, "left": getStackLiLeft, "top": getStackLiTop, "zIndex": 300 }, moveSpeed); } else if (i < zIndexStack2 + 1) { _this.find("li").eq(i).css({ "zIndex": i }); _this.find("li").eq(i).stop().animate({ "width": getStackLiWidth * Math.pow(stack2Compare, zIndexStack2 + 1 - i), "height": ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, zIndexStack2 - i))) * stack2Compare) / getStackLiWidth * getStackLiHeight, "left": _this.find("li").eq(i - theCha).position().left - paraStackLeft2, "marginLeft": 0, "top": _this.find("li.active").position().top + _this.find("li.active").height() / 2 - ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, zIndexStack2 - i))) * stack2Compare) / getStackLiWidth * getStackLiHeight / 2 }, moveSpeed); } else if (i > zIndexStack2 + 1) { //alert(zIndexStack2) _this.find("li").eq(i).css({ "zIndex": banner_size - i }); _this.find("li").eq(i).stop().animate({ "width": getStackLiWidth * Math.pow(stack2Compare, (zIndexStack2 - (i - 1)) * -1), "height": ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, (zIndexStack2 - (i - 1)) * -1)))) / getStackLiWidth * getStackLiHeight, "marginLeft": 0, "top": _this.find("li.active").position().top + _this.find("li.active").height() / 2 - ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, (zIndexStack2 - (i - 1)) * -1)))) / getStackLiWidth * getStackLiHeight / 2, "left": _this.find("li").eq(i - theCha - 1).position().left }, moveSpeed); } } } _this.find(".dlWrap span:eq(" + nIndex + ")").removeClass().addClass("active").siblings().removeClass(); pictureCount = nIndex; pictureShows.prototype.arrow(name, type, arrow, thum_num, moveSpeed, pictureCount); } } if (type == "opacity") { _this.find("li").eq(0).css("zIndex", 2).show().siblings().css("zIndex", 1).hide(); jQuery(".picture_box").stop().animate({ "opacity": 1 }); _this.find(".dlWrap span").on("click", function () { var nIndex = _this.find("span").index(this); _this.parent().find(".picture_text font").text(nIndex + 1); _this.parent().find(".pic_top > div:eq(" + nIndex + ")").show().siblings().hide(); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, nIndex); $(".cont .inner:eq("+nIndex+")").show().siblings().hide(); opacity_move(_this, nIndex); pictureCount = nIndex; }) //缩略图按钮 for opacity _this.parent().find(".picture_thum_box li").on("click", function () { var nIndex = _this.parent().find(".picture_thum_box li").index(this); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, nIndex); opacity_move(_this, nIndex); pictureCount = nIndex; }) } else if (type == "slide") { _this.find("li").width(_this.width()); jQuery(".picture_box").stop().animate({ "opacity": 1 }); _this.find(".dlWrap span").on("click", function () { if (!_this.find("li").is(":animated")) { var nIndex = _this.find("span").index(this); _this.parent().find(".picture_text font").text(nIndex + 1); _this.parent().find(".pic_top > div:eq(" + nIndex + ")").show().siblings().hide(); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, nIndex); slide_move(_this, nIndex); pictureCount = nIndex; } }) //缩略图按钮 for slide _this.parent().find(".picture_thum_box li").on("click", function () { if (!_this.find("ul").is(":animated")) { var nIndex = _this.parent().find(".picture_thum_box li").index(this); _this.parent().find(".pic_top > div:eq(" + nIndex + ")").show().siblings().hide(); slide_move(_this, nIndex); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureCount = nIndex; } }) } else if (type == "side") { var margR = Number(_this.parent().find(".picture_box li:eq(" + 0 + ")").css("marginRight").replace('px', '')); var margA = _this.find("li:eq(0)").width() + margR; _this.find("ul").stop().css({ "left": -1 * margA * 0 + (_this.width() / 2 - _this.find("li:eq(0)").width() / 2) }); jQuery(".picture_box").stop().animate({ "opacity": 1 }); _this.find("ul li").on("click", function () { if (!_this.find("ul").is(":animated")) { var nIndex = _this.find("li").index(this); _this.parent().find(".pic_top > div:eq(" + nIndex + ")").show().siblings().hide(); side_move(_this, nIndex); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, nIndex); pictureCount = nIndex; } }) _this.find(".dlWrap span").on("click", function () { if (!_this.find("ul").is(":animated")) { var nIndex = _this.find("span").index(this); _this.parent().find(".pic_top > div:eq(" + nIndex + ")").show().siblings().hide(); side_move(_this, nIndex); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, nIndex); pictureCount = nIndex; } }) _this.parent().find(".picture_thum_box li").on("click", function () { if (!_this.find("ul").is(":animated")) { var nIndex = _this.parent().find(".picture_thum_box li").index(this); jQuery(".picture_tit").html(_this.parent().find(".picture_box ul li:eq(" + nIndex + ") img").attr("data-tit")); jQuery(".picture_tit").html(_this.parent().find(".picture_thum_box ul li:eq(" + nIndex + ") img").attr("data-tit")); _this.parent().find(".pic_top > div:eq(" + nIndex + ")").show().siblings().hide(); side_move(_this, nIndex); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, nIndex); pictureCount = nIndex; if (nIndex == 0) { jQuery(".picture_arrow_left,.picture_thum_left").addClass('active'); } else if (jQuery('.picture_thum_box li').size() - 1 > nIndex > 0) { jQuery(".picture_arrow_left,.picture_thum_left").removeClass('active'); jQuery(".picture_arrow_right,.picture_thum_right").removeClass('active'); } else if (nIndex == jQuery('.picture_thum_box li').size() - 1) { jQuery(".picture_arrow_right,.picture_thum_right").addClass('active'); } } }) } else if (_this.hasClass("stack")) { var getStackLiWidth = _this.find("li.active").width(); var getStackLiHeight = _this.find("li.active").width(); var paraStackWidth = 0.9; for (var i = 1; i < stackNum; i++) { var nowStackli = _this.find("li").eq(i); var beforeStackli = _this.find("li").eq(i - 1); _this.find("li").eq(i).css({ "width": beforeStackli.width() * paraStackWidth, "height": beforeStackli.height() * paraStackWidth, "left": beforeStackli.position().left + beforeStackli.width() * paraStackLeft, "top": beforeStackli.position().top + beforeStackli.height() * 0.5 - beforeStackli.height() * paraStackWidth / 2, "zIndex": stackNum - i }); } jQuery(".picture_box").stop().animate({ "opacity": 1 }); //menu for stack _this.find(".dlWrap span").on("click", function () { if (!_this.find("li").is(":animated")) { var nIndex = _this.find("span").index(this); stack_move(_this, nIndex); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureCount = nIndex; } }) //缩略图按钮 for stack _this.parent().find(".picture_thum_box li").on("click", function () { if (!_this.find("li").is(":animated")) { var nIndex = _this.parent().find(".picture_thum_box li").index(this); stack_move(_this, nIndex); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureCount = nIndex; } }) } else if (_this.hasClass("stack2")) { var getStackLiWidth = _this.find("li.active").width(); var getStackLiHeight = _this.find("li.active").height(); var getStackLiLeft = _this.find("li.active").position().left; var stack2Compare = paraStackLeft3; var stack2Compare_left = 0.2; var stack2Count = stackNum2; var theActive = Math.floor(stack2Count / 2); if (stack2Count % 2 == 0) { alert("哥们儿,请输入奇数个数,要不显示不出来啊"); } _this.find("li").eq(theActive).css({ "width": getStackLiWidth, "height": getStackLiHeight }); var margR = Number(_this.parent().find(".picture_box li:eq(" + 0 + ")").css("marginRight").replace('px', '')); //var getStackLiTop = _this.find("li.active").position().top; for (var i = 1; i < theActive + 1; i++) { getStackLiWidth = getStackLiWidth * stack2Compare; getStackLiHeight = ((getStackLiWidth * stack2Compare) / getStackLiWidth) * getStackLiHeight; var prevActive = _this.find("li").eq(theActive - i); var prevActiveLeft = _this.find("li").eq(theActive - i + 1); var nextActive = _this.find("li").eq(theActive + i); _this.find("li").eq(theActive).css("zIndex", 10); prevActive.css({ "width": getStackLiWidth, "height": getStackLiHeight, "left": _this.find("li").eq(theActive - i + 1).position().left - paraStackLeft2, "marginLeft": 0, "zIndex": 10 - i, "top": _this.find("li").eq(theActive).position().top + _this.find("li").eq(theActive).height() / 2 - getStackLiHeight / 2 }); nextActive.css({ "width": getStackLiWidth, "height": getStackLiHeight, "left": _this.find("li").eq(theActive + i - 1).position().left + (_this.find("li").eq(theActive - i + 1).width() - _this.find("li").eq(theActive - i).width()) + paraStackLeft2, "marginLeft": 0, "zIndex": 10 - i, "top": _this.find("li").eq(theActive).position().top + _this.find("li").eq(theActive).height() / 2 - getStackLiHeight / 2 }); } //缩略图按钮 for stack _this.parent().find(".picture_thum_box li").on("click", function () { if (!_this.find("li").is(":animated")) { var nIndex = _this.parent().find(".picture_thum_box li").index(this); stack_move2(_this, nIndex); pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureCount = nIndex; } }) jQuery(".picture_box").stop().animate({ "opacity": 1 }); } } //自动切换模式运动 pictureShows.prototype.showMove = function (name, type, pictureCount, dir, moveSpeed, pictureCount) { var _this = jQuery("." + name), banner_size = _this.find("ul li").size(); var typeStrs = type.split("_"); if (typeStrs[0] == "stack") { var stackNum = Number(typeStrs[1]); var paraStackLeft = Number(typeStrs[2]) / 10; } if (typeStrs[0] == "stack2") { var stackNum2 = Number(typeStrs[1]); var paraStackLeft2 = Number(typeStrs[2]); var paraStackLeft3 = Number(typeStrs[3]) / 10; } if (type == "opacity") { if (!_this.find("li").is(":animated")) { _this.find("li").eq(pictureCount).fadeIn().siblings().fadeOut(); _this.find("li").eq(pictureCount).css("zIndex", 2).siblings().css("zIndex", 1); $(".cont .inner:eq("+pictureCount+")").show().siblings().hide(); } } else if (type == "slide") { if (dir == "left") { _this.find("li").eq(pictureCount).css("left", _this.width() * -1); _this.find("ul").stop().animate({ "left": _this.width() }, { easing: 'easeInOutQuad', duration: moveSpeed, complete: function () { _this.find("li").eq(pictureCount).addClass("active").siblings().removeClass(); _this.find("ul").css("left", 0); _this.find("li").css("left", _this.find("li").eq(pictureCount).width() * 2); _this.find("li").eq(pictureCount).css("left", 0); _this.find("li").eq(pictureCount - 1).css("left", _this.find("li").eq(pictureCount).width()); jQuery(".picture_box1.slide ul li").css("left", jQuery(".picture_box1.slide ul li:eq(" + pictureCount + ")").width() * 2); jQuery(".picture_box1.slide ul li:eq(" + pictureCount + ")").css("left", 0); } }); jQuery(".picture_box1.slide ul").height(jQuery(".picture_box1.slide ul").find("li").eq(pictureCount).find("img").height() + jQuery(".picture_box1.slide ul").find("li").eq(pictureCount).find("p").height()); } else { _this.find("li").eq(pictureCount).css("left", _this.width()); _this.find("ul").stop().animate({ "left": -1 * _this.width() }, { easing: 'easeInOutQuad', duration: moveSpeed, complete: function () { _this.find("li").eq(pictureCount).addClass("active").siblings().removeClass(); _this.find("ul").css("left", 0); _this.find("li").css("left", _this.find("li").eq(pictureCount).width() * 2); _this.find("li").eq(pictureCount).css("left", 0); _this.find("li").eq(pictureCount + 1).css("left", _this.find("li").eq(pictureCount).width()); jQuery(".picture_box1.slide ul li").css("left", jQuery(".picture_box1.slide ul li:eq(" + pictureCount + ")").width() * 2); jQuery(".picture_box1.slide ul li:eq(" + pictureCount + ")").css("left", 0); } }); jQuery(".picture_box1.slide ul").height(jQuery(".picture_box1.slide ul").find("li").eq(pictureCount).find("img").height() + jQuery(".picture_box1.slide ul").find("li").eq(pictureCount).find("p").height()); } } else if (type == "side") { var margR = Number(_this.parent().find(".picture_box li:eq(" + 0 + ")").css("marginRight").replace('px', '')); var margA = _this.find("li:eq(0)").width() + margR; _this.find("ul").stop().animate({ "left": -1 * margA * pictureCount + (_this.width() / 2 - _this.find("li:eq(0)").width() / 2) }, { easing: 'easeInOutQuad', duration: moveSpeed }); jQuery(".picture_tit").html(_this.parent().find(".picture_box ul li:eq(" + pictureCount + ") img").attr("data-tit")); jQuery(".picture_tit").html(_this.parent().find(".picture_thum_box ul li:eq(" + pictureCount + ") img").attr("data-tit")); } else if (_this.hasClass("stack")) { var getStackLiWidth = _this.find("li.active").width(); var getStackLiHeight = _this.find("li.active").width(); var paraStackWidth = 0.9; var stackEve = pictureCount + stackNum; var indexTop = 2000; var wxSum = 0; var beforeStackli = _this.find("li.active"); if (nIndex == banner_size - 1) { var paraLeftMX = (beforeStackli.position().left); } else { var paraLeftMX = (beforeStackli.position().left + beforeStackli.width() * paraStackLeft); } _this.find("li").stop().animate({ "width": beforeStackli.width() * Math.pow(paraStackWidth, stackNum), "height": beforeStackli.height() * Math.pow(paraStackWidth, stackNum), "left": paraLeftMX, "top": beforeStackli.position().top + beforeStackli.height() * 0.5 - beforeStackli.height() * Math.pow(paraStackWidth, stackNum) / 2 }, moveSpeed); var stackCount = 0; for (var i = pictureCount; i < stackEve; i++) { stackCount++; wxSum = 0; var nowStackli = _this.find("li").eq(i); if (i == pictureCount) { _this.find("li").eq(i).css("zIndex", 3000); _this.find("li").eq(i).stop().animate({ "width": beforeStackli.width(), "height": beforeStackli.height(), "left": beforeStackli.position().left, "top": beforeStackli.position().top }, moveSpeed); } else { if (dir == "right") { for (var j = pictureCount; j <= i - 2; j++) { wxSum += beforeStackli.width() * Math.pow(paraStackWidth, stackCount) * paraStackLeft + beforeStackli.width() * 0.04; } _this.find("li").eq(i).css("zIndex", indexTop - i); _this.find("li").eq(i).stop().animate({ "width": beforeStackli.width() * Math.pow(paraStackWidth, stackCount - 1), "height": beforeStackli.height() * Math.pow(paraStackWidth, stackCount - 1), "left": paraLeftMX + wxSum, "top": beforeStackli.position().top + beforeStackli.height() * 0.5 - beforeStackli.height() * Math.pow(paraStackWidth, stackCount - 1) / 2 }, moveSpeed); beforeStackli.css("zIndex", 1); beforeStackli.stop().animate({ "width": beforeStackli.width() * Math.pow(paraStackWidth, stackNum), "height": beforeStackli.height() * Math.pow(paraStackWidth, stackNum), "left": paraLeftMX, "top": beforeStackli.position().top + beforeStackli.height() * 0.5 - beforeStackli.height() * Math.pow(paraStackWidth, stackNum) / 2 }, moveSpeed); } else { for (var j = pictureCount; j <= i - 2; j++) { wxSum += beforeStackli.width() * Math.pow(paraStackWidth, stackCount) * paraStackLeft + beforeStackli.width() * 0.04; } _this.find("li").eq(i).css("zIndex", indexTop - i); _this.find("li").eq(i).stop().animate({ "width": beforeStackli.width() * Math.pow(paraStackWidth, stackCount - 1), "height": beforeStackli.height() * Math.pow(paraStackWidth, stackCount - 1), "left": paraLeftMX + wxSum, "top": beforeStackli.position().top + beforeStackli.height() * 0.5 - beforeStackli.height() * Math.pow(paraStackWidth, stackCount - 1) / 2 }, moveSpeed); _this.find("li").eq(pictureCount + 4).css("zIndex", 1); _this.find("li").eq(pictureCount + 4).stop().animate({ "width": beforeStackli.width() * Math.pow(paraStackWidth, stackNum), "height": beforeStackli.height() * Math.pow(paraStackWidth, stackNum), "left": paraLeftMX, "top": beforeStackli.position().top + beforeStackli.height() * 0.5 - beforeStackli.height() * Math.pow(paraStackWidth, stackNum) / 2 }, moveSpeed); } } } _this.find("li").eq(pictureCount).removeClass().addClass("active").siblings().removeClass(); } else if (_this.hasClass("stack2")) { var stack2Count = stackNum2; var theActive = Math.floor(stack2Count / 2); var zIndexStack2 = pictureCount + theActive - 1; if (dir == "right") { _this.find("li").eq(zIndexStack2).addClass("active"); _this.find("li").eq(zIndexStack2).siblings().removeClass("active"); } else if (dir == "left") { _this.find("li").eq(zIndexStack2 + 2).addClass("active"); _this.find("li").eq(zIndexStack2 + 2).siblings().removeClass("active"); } var getStackLiWidth = _this.find("li.active").width(); var getStackLiHeight = _this.find("li.active").height(); var getStackLiLeft = _this.find("li.active").position().left; var getStackLiTop = _this.find("li.active").position().top; var stack2Compare = paraStackLeft3; var stack2Compare_left = 0.2; //alert(zIndexStack2+1) _this.find("li").css({ "zIndex": -1 }); _this.find("li").stop().animate({ "width": 1, "height": 1, "left": getStackLiLeft + getStackLiWidth * Math.pow(stack2Compare, theActive) / 2, "top": getStackLiTop + ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, theActive) / 2)) * stack2Compare) / getStackLiWidth * getStackLiHeight }, moveSpeed); var addzIndexStack2 = zIndexStack2 + 1; _this.parent().find(".picture_box ul li:eq(" + addzIndexStack2 + ") p").show(); _this.parent().find(".picture_box ul li:eq(" + addzIndexStack2 + ") p").parent().siblings().find("p").hide(); if (dir == "right") { for (var i = zIndexStack2 - (Math.floor(stack2Count / 2) - 1) ; i <= zIndexStack2 + (stack2Count - (Math.floor(stack2Count / 2))) ; i++) { if (i == zIndexStack2 + 1) { _this.find("li").eq(i).css({ "zIndex": 300 }) _this.find("li").eq(i).stop().animate({ "width": getStackLiWidth, "height": getStackLiHeight, "left": getStackLiLeft, "top": getStackLiTop, "zIndex": 300 }, moveSpeed); } else if (i < zIndexStack2 + 1) { try { var tryleft = _this.find("li").eq(i).position().left - paraStackLeft2; } catch (e) { } _this.find("li").eq(i).css({ "zIndex": i }); _this.find("li").eq(i).stop().animate({ "width": getStackLiWidth * Math.pow(stack2Compare, zIndexStack2 + 1 - i), "height": ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, zIndexStack2 - i))) * stack2Compare) / getStackLiWidth * getStackLiHeight, "left": tryleft, "marginLeft": 0, "top": _this.find("li.active").position().top + _this.find("li.active").height() / 2 - ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, zIndexStack2 - i))) * stack2Compare) / getStackLiWidth * getStackLiHeight / 2 }, moveSpeed); } else if (i > zIndexStack2 + 1) { //alert(zIndexStack2) try { var tryleft = _this.find("li").eq(i - 1).position().left; } catch (e) { } _this.find("li").eq(i).css({ "zIndex": banner_size - i }); _this.find("li").eq(i).stop().animate({ "width": getStackLiWidth * Math.pow(stack2Compare, (zIndexStack2 - (i - 1)) * -1), "height": ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, (zIndexStack2 - (i - 1)) * -1)))) / getStackLiWidth * getStackLiHeight, "marginLeft": 0, "top": _this.find("li.active").position().top + _this.find("li.active").height() / 2 - ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, (zIndexStack2 - (i - 1)) * -1)))) / getStackLiWidth * getStackLiHeight / 2, "left": tryleft }, moveSpeed); } } } else if (dir == "left") { //alert(1) //alert(getStackLiWidth) for (var i = zIndexStack2 - (Math.floor(stack2Count / 2) - 1) ; i <= zIndexStack2 + (stack2Count - (Math.floor(stack2Count / 2))) ; i++) { if (i == zIndexStack2 + 1) { //alert(i) _this.find("li").eq(i).css({ "zIndex": 300 }) _this.find("li").eq(i).stop().animate({ "width": getStackLiWidth, "height": getStackLiHeight, "left": getStackLiLeft, "top": getStackLiTop, "zIndex": 300 }, moveSpeed); } else if (i < zIndexStack2 + 1) { if (i >= 0) { var tryleft = _this.find("li").eq(i + 2).position().left - paraStackLeft2; _this.find("li").eq(i).css({ "zIndex": i }); _this.find("li").eq(i).stop().animate({ "width": getStackLiWidth * Math.pow(stack2Compare, zIndexStack2 + 1 - i), "height": ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, zIndexStack2 - i))) * stack2Compare) / getStackLiWidth * getStackLiHeight, "left": tryleft, "marginLeft": 0, "top": _this.find("li.active").position().top + _this.find("li.active").height() / 2 - ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, zIndexStack2 - i))) * stack2Compare) / getStackLiWidth * getStackLiHeight / 2 }, moveSpeed); } } else if (i > zIndexStack2 + 1) { //alert(zIndexStack2) if (i <= banner_size - 1) { if (i == banner_size - 1) { var tryleft = _this.find("li").eq(i).position().left + (_this.find("li").eq(i).width() - getStackLiWidth * Math.pow(stack2Compare, (zIndexStack2 - (i - 1)) * -1)) + paraStackLeft2; } else { var tryleft = _this.find("li").eq(i).position().left + (_this.find("li").eq(i).width() - getStackLiWidth * Math.pow(stack2Compare, (zIndexStack2 - (i - 1)) * -1)) + paraStackLeft2; } _this.find("li").eq(i).css({ "zIndex": banner_size - i }); _this.find("li").eq(i).stop().animate({ "width": getStackLiWidth * Math.pow(stack2Compare, (zIndexStack2 - (i - 1)) * -1), "height": ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, (zIndexStack2 - (i - 1)) * -1)))) / getStackLiWidth * getStackLiHeight, "marginLeft": 0, "top": _this.find("li.active").position().top + _this.find("li.active").height() / 2 - ((Math.ceil(getStackLiWidth * Math.pow(stack2Compare, (zIndexStack2 - (i - 1)) * -1)))) / getStackLiWidth * getStackLiHeight / 2, "left": tryleft }, moveSpeed); //alert(_this.find("li").eq(i).width()) } } } } } _this.parent().find(".picture_text font").text(pictureCount + 1); _this.parent().find(".pic_top > div:eq(" + pictureCount + ")").show().siblings().hide(); _this.find(".dlWrap span:eq(" + pictureCount + ")").removeClass().addClass("active").siblings().removeClass(); return pictureCount; } //自动 pictureShows.prototype.auto = function (name, type, auto_play, speed, thum_num, moveSpeed, pictureCount) { var _this = jQuery("." + name), banner_size = _this.find("ul li").size(); if (auto_play == true) { if (type != undefined) { _this.parent().find(/*"."+name+",*/"." + name + " .dlWrap span, .picture_arrow_left, .picture_arrow_right,.pic_scroll_hand,.picture_thum_box,.picture_thum_left,.picture_thum_right").on("mouseover", function () { clearTimeout(pictureTimer); }) _this.parent().find(/*"."+name+",*/"." + name + " .dlWrap span, .picture_arrow_left, .picture_arrow_right,.pic_scroll_hand,.picture_thum_box,.picture_thum_left,.picture_thum_right").on("mouseout", function () { clearTimeout(pictureTimer); pictureTimer = setInterval(function () { if (pictureCount >= banner_size - 1) { pictureCount = 0; pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureShows.prototype.showMove(name, type, pictureCount, "right", moveSpeed, pictureCount); } else { pictureCount++; pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureShows.prototype.showMove(name, type, pictureCount, "right", moveSpeed, pictureCount); } }, speed) }) var _this = jQuery("." + name), banner_size = _this.find("ul li").size(); pictureTimer = setInterval(function () { if (pictureCount >= banner_size - 1) { pictureCount = 0 pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureShows.prototype.showMove(name, type, pictureCount, "right", moveSpeed, pictureCount); } else { pictureCount++; pictureShows.prototype.thum_scroll_move(name, thum_num, moveSpeed, pictureCount); pictureShows.prototype.showMove(name, type, pictureCount, "right", moveSpeed, pictureCount); } }, speed) } } return pictureCount; } //缩略图位置判断方法 pictureShows.prototype.thum_scroll_move = function (name, thum_num, moveSpeed, pictureCount) { var _this = jQuery("." + name), banner_size = _this.find("ul li").size(); try { var margR = Number(_this.parent().find(".picture_thum_box li:eq(" + pictureCount + ")").css("marginRight").replace('px', '')); } catch (e) { } if ((pictureCount >= 0 && pictureCount <= Math.floor(thum_num / 2 - 1)) || (pictureCount <= banner_size - 1 && pictureCount >= banner_size - Math.floor(thum_num / 2))) { if (pictureCount >= 0 && pictureCount <= Math.floor(thum_num / 2 - 1)) { _this.parent().find(".picture_thum_box ul").stop().animate({ "left": 0 }); } else { if (_this.parent().find(".picture_thum_box ul li").size() > thum_num) { _this.parent().find(".picture_thum_box ul").stop().animate({ "left": banner_size * -1 * (_this.parent().find(".picture_thum_box ul li").width() + margR) + (_this.parent().find(".picture_thum_box ul li").width() + margR) * thum_num }, { easing: 'easeInOutQuad', duration: moveSpeed }); } } } else { _this.parent().find(".picture_thum_box ul").stop().animate({ "left": (pictureCount * -1 * (_this.parent().find(".picture_thum_box ul li").width() + margR)) + (_this.parent().find(".picture_thum_box ul li").width() + margR) * Math.floor(thum_num / 2) }, { easing: 'easeInOutQuad', duration: moveSpeed }); } _this.parent().find(".picture_text font").text(pictureCount + 1); _this.parent().find(".pic_top > div:eq(" + pictureCount + ")").show().siblings().hide(); _this.parent().find(".picture_thum_box li:eq(" + pictureCount + ")").removeClass().addClass("active").siblings().removeClass(); //进度条开始 if (_this.parent().find(".picture_thum_box ul li").size() > thum_num) { if (pictureCount == banner_size - 1) { _this.parent().find(".pic_scroll_hand span").stop().animate({ "left": _this.parent().find(".pic_scroll_hand").width() - _this.parent().find(".pic_scroll_hand span").width() }, { easing: 'easeInOutQuad', duration: moveSpeed }); } else if (pictureCount == 0) { _this.parent().find(".pic_scroll_hand span").stop().animate({ "left": 0 }, { easing: 'easeInOutQuad', duration: moveSpeed }); } else { _this.parent().find(".pic_scroll_hand span").stop().animate({ "left": (_this.parent().find(".pic_scroll_hand").width() / (banner_size + 1)) * pictureCount }, { easing: 'easeInOutQuad', duration: moveSpeed }); } } } //左右切换 pictureShows.prototype.arrow = function (name, type, arrow, thum_num, moveSpeed, pictureCount) { var _this = jQuery("." + name), banner_size = _this.find("ul li").size(); _this.parent().find(".picture_text font").text(pictureCount + 1); _this.parent().find(".pic_top > div:eq(" + pictureCount + ")").show().siblings().hide(); _this.parent().find(".picture_thum_box li:eq(" + pictureCount + ")").removeClass().addClass("active").siblings().removeClass(); } //滚动条 var scrollTimer = null; var picture_roll_num = 0; pictureShows.prototype.control = function (name, type, control, thum_num, moveSpeed, pictureCount) { var _this = jQuery("." + name), banner_size = _this.find("ul li").size(); try { var margR = Number(_this.parent().find(".picture_thum_box li:eq(" + 0 + ")").css("marginRight").replace('px', '')); } catch (e) { } //alert(thum_num) if (control == "scroll" || control == "scroll_and_sj") { _this.parent().find(".pic_scroll_hand span").draggable({ axis: "x", containment: "parent", opacity: 0.5, drag: function (event, ui) { var leftPosition = _this.parent().find(".pic_scroll_hand span").position().left; var para = _this.parent().find(".pic_scroll_hand").width() / (banner_size / 1.5) * (banner_size / 1.5 - 1); var scrolliWidth = (_this.parent().find(".picture_thum_box ul li").width() + margR) * (banner_size - thum_num); var paramScroll = scrolliWidth / para; _this.parent().find(".picture_thum_box ul").css({ "left": -1 * leftPosition * paramScroll }); } }); } return pictureCount; }