锘縥Query.extend( jQuery.easing, { def: 'easeOutQuad', easeOutBounce: function (x, t, b, c, d) { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; } else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; } else { return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; } } }); Array.prototype.shuffle = function () { for (var j, x, i = this.length; i; j = parseInt(Math.random() * i), x = this[--i], this[i] = this[j], this[j] = x); return this }; function loadImage(url, callback) { var img = new Image(); img.src = url; if (img.complete) { callback.call(img); return; } img.onload = function () { callback.call(img); }; }; $(function () { $("#footer .icon-wx").hover(function () { if ($(".qr-code", $(this).parent()).length) { $(".qr-code", $(this).parent()).stop().fadeIn() } else { $('
').appendTo($(this).parent()).stop().hide().fadeIn() } }, function () { $(".qr-code", $(this).parent()).stop().fadeOut() }) $("#footer .icon_phone").hover(function () { $(this).find("span").stop().fadeIn(); }, function () { $(this).find("span").stop().fadeOut() }) }); $(function () { function getViewSize_city(){ return {"w": window['innerWidth'] || document.documentElement.clientWidth} } function getFullSize_city(){ var w = Math.max(document.documentElement.clientWidth ,document.body.clientWidth) + Math.max(document.documentElement.scrollLeft, document.body.scrollLeft); w = Math.max(document.documentElement.scrollWidth,w); return {"w":w}; } var city_html_two='
'; var city_html_three='
'; function setContainerSize_city(){ size=getViewSize_city(); if(size["w"]>1280){ if(size["w"]>1440){ $("#J_top_city").html(city_html_two).removeClass().addClass("city_1000").show(); } else if(size["w"]>1280&&size["w"]<=1440){ $("#J_top_city").html(city_html_two).removeClass().addClass("city_900").show(); } city_move(); } else{ $("#J_top_city").html(city_html_three).removeClass().addClass("city").show(); city_move(); } } setContainerSize_city(); window.onresize=setContainerSize_city; function city_move(){ var $city = $("#J_top_city"), index = 0, timer = null; $(".next", $city).on("click", function (e) { $(this).hide(); index = 0; clearTimeout(timer); $(".item li", $city).css({ top: "62px" }); $(".item.on", $city).next().addClass("on").siblings().removeClass("on"); var arr = [], size = $(".item.on", $city).find("li").length; for (var i = 0; i < size; i++) arr[i] = i; arr.shuffle(); cityAnimate($(".item.on", $city).find("li"), arr, function () { if ($(".item.on", $city).index() - 1 == $(".item", $city).length) { $(".prev", $city).show(); } else { $(".next", $city).show(); $(".prev", $city).show(); } }); }); $(".prev", $city).on("click", function (e) { $(this).hide(); index = 0; clearTimeout(timer); $(".item li", $city).css({ top: "62px" }); $(".item.on", $city).prev().addClass("on").siblings().removeClass("on") var arr = [], size = $(".item.on", $city).find("li").length; for (var i = 0; i < size; i++) arr[i] = i; arr.shuffle(); cityAnimate($(".item.on", $city).find("li"), arr, function () { if ($(".item.on", $city).index() - 1 == 1) { $(".next", $city).show(); } else { $(".prev", $city).show(); $(".next", $city).show(); } }); }); var cityAnimate = function (obj, array, callback) { if (index < array.length) { obj.eq(array[index]).animate({'top':0},{queue:false, duration:400, easing: "easeOutBounce"}); index++; timer = setTimeout(function () { cityAnimate(obj, array, callback) }, 200) } else { callback && callback.call(); index = 0; clearTimeout(timer) } } } });