let tap = "ontouchstart" in window ? "tap" : "click"; (function ($, fn) { $(document).ready(fn); }(jQuery, function () { var wrap = $(".swiperContainer"); $.each(wrap, function (index, el) { var _this = $(this); (function (banner) { var navs, imgs, adnav, center, icur, prev, next, showIndex, btn_prev, btn_next, clickDown, bannerTimer, moveEnd; if (!banner[0]) return; imgs = banner.find(".swiperItem"); adnav = banner.find(".swiperNav"); btn_prev = banner.find(".prevbtn"); btn_next = banner.find(".nextbtn"); showIndex = 0; moveEnd = false; clickDown = false; function animateLeft(index) { if (moveEnd) return; moveEnd = true; showIndex = index; next = imgs.eq(showIndex); next.addClass("next"); navs.removeClass("icur").eq(showIndex).addClass("icur"); icur.stop().animate({ "left": "-100%" }, 500, "swing"); next.stop().animate({ "left": "0" }, 500, "swing", function () { imgs.removeClass("icur").removeClass("prev").removeClass("next"); icur = imgs.eq(showIndex); icur.addClass("icur"); imgs.removeAttr("style"); moveEnd = false; clickDown = false; }); } function animateRight(index) { if (moveEnd) return; moveEnd = true; showIndex = index; prev = imgs.eq(showIndex); prev.addClass("prev"); navs.removeClass("icur").eq(showIndex).addClass("icur"); icur.stop().animate({ "left": "100%" }, 500, "swing"); prev.stop().animate({ "left": "0" }, 500, "swing", function () { imgs.removeClass("icur").removeClass("prev").removeClass("next"); icur = imgs.eq(showIndex); icur.addClass("icur"); imgs.removeAttr("style"); moveEnd = false; clickDown = false; }); } function autoplay() { showIndex++; showIndex %= imgs.length; animateLeft(showIndex); } ( function () { if (imgs.length < 2) return; center = $("