(function () { var popIE = function () { if (window.innerWidth >= 680) { function IETester(userAgent) { var UA = userAgent || navigator.userAgent; if (/msie/i.test(UA)) { return UA.match(/msie (\d+\.\d+)/i)[1]; } else if (~UA.toLowerCase().indexOf('trident') && ~UA.indexOf('rv')) { return UA.match(/rv:(\d+\.\d+)/)[1]; } return false; } if (IETester() == 9.0 || IETester() == 8.0 || IETester() == 7.0 || IETester() == 6.0 || IETester() == 5.0) { var hintIE = '
鎮ㄧ殑ie鐗堟湰杩囦綆锛屽皢鍙兘褰卞搷姝e父娴忚缃戦〉锛?/div>
'; $("body").prepend(hintIE); $(".popIE").show(); $(".popIE-close").click(function () { $(".popIE").hide(); }); } IETester('Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko'); } } var equipmentFn = function () { if (window.innerWidth >= 1000) { $("body").addClass("PC"); } else { $("body").removeClass("PC"); } if (window.innerWidth < 1000 && window.innerWidth >= 640) { $("body").addClass("PAD"); } else { $("body").removeClass("PAD"); } if (window.innerWidth < 640) { $("body").addClass("MB"); } else { $("body").removeClass("MB"); } } var mbPenetrate = function (el) { var elNum = document.getElementsByClassName(el).length; if (window.innerWidth >= 1000 || elNum == 0) { return false; } for (var i = 0; i < elNum; i++) { var elScroll = document.getElementsByClassName(el)[i], targetY = null; elScroll.addEventListener("touchstart", function (e) { targetY = Math.floor(e.targetTouches[0].clientY) }, { passive: true }); elScroll.addEventListener("touchmove", function (e) { var newTargetY = Math.floor(e.targetTouches[0].clientY), scrollTop = elScroll.scrollTop, realHeight = elScroll.scrollHeight, viewHeight = elScroll.clientHeight; if (scrollTop <= 0 && newTargetY - targetY > 0 && e.cancelable) { e.preventDefault(); } else if (scrollTop >= realHeight - viewHeight && newTargetY - targetY < 0 && e.cancelable) { e.preventDefault(); } }, { passive: true }); } } var banDrag = function () { $("body").find("img,a").attr("ondragstart", "return false"); } var navbarFn = function () { $('.Header-navclick').click(function () { if (window.innerWidth < 1000 && $(".Header-search-click").length > 0) { $(".Header-search-click").removeClass("active"); $(".Header-search-item").removeClass("active"); $("body").removeClass("onSearch"); } if ($('.Header-navbar').is(':hidden')) { $('.Header-wrapper').addClass('mb'); $(this).addClass('active'); $('.Header-navbar').fadeIn(360).addClass("active"); $("body,html").css({ "overflow": "hidden" }); } else { $('.Header-wrapper').removeClass('mb'); $(this).removeClass('active'); $('.Header-navbar').fadeOut(300).removeClass("active"); $("body,html").css({ "overflow": "" }); } }); } var lyb = function () { if (window.innerWidth < 640) { $('.Header-menu.lyb').click(function () { $('.Header-wrapper').removeClass('mb'); $('.Header-navbar').fadeOut(300).removeClass("active"); $('.Header-navclick').removeClass('active'); $('.Footer-message').addClass('active') }) $('.Footer-message-close').click(function () { $('.Footer-message').removeClass('active'); $("body,html").css({ "overflow": "" }); }) } else { return false; } } var headerLi = function () { if (window.innerWidth >= 1000) { return false; } var liTime = 0.1; $(".Header-navbar ul li").each(function () { $(this).css('transition-delay', liTime + 's'); liTime += 0.1; }); } var searchFn = function () { $(".Header-search-click").click(function () { if (window.innerWidth < 1000 && $(".Header-navclick").length > 0) { $('.Header-navclick').removeClass('active'); $('.Header-navbar').hide().removeClass("active"); $("body,html").css({ "overflow": "" }); } if (!$(this).hasClass("active")) { $(this).addClass("active"); $(".Header-search-item").addClass("active"); $("body").addClass("onSearch"); } else { $(this).removeClass("active"); $(".Header-search-item").removeClass("active"); $("body").removeClass("onSearch"); } }); } var headerLine = function (e) { if (window.innerWidth >= 1000 && $('.Header-navbar li.active').length > 0) { if ($('.Header-line').length < 1) { $('.Header-navbar').append(''); } var headerLi = [], activeLi = e, navLeft = $('.Header-navbar').offset().left, line = $('.Header-line'); $('.Header-navbar li').each(function (i) { headerLi.push({ n: i, l: $(this).offset().left - navLeft + $(this).innerWidth() / 2 }) }) $('.Header-line').css({ left: headerLi[activeLi].l }) line.show(); $('.Header-navbar li').hover(function () { line.stop().css({ left: headerLi[$(this).index()].l }); }) $('.Header-navbar').mouseleave(function () { line.hide(); }); $('.Header-logo').hover(function () { $('.logo-label').stop().animate({ top: 80 + '%', opacity: 1 }, 400); }, function () { $('.logo-label').stop().animate({ top: 50 + '%', opacity: 0 }, 400); } ) } else { $('.Header-line').remove(); } } var headerDrop = function () { if (window.innerWidth < 1000) { return false; } $(".Header-navbar li").hover(function () { headerLine($(this).index());//瀵艰埅鍦嗙偣 if ($(this).index() === 1) { $(".Header-drop").stop().slideDown(360); } }, function () { $(".Header-drop").stop().slideUp(300); }); $(".Header-drop").hover(function () { $(".Header-drop").stop().slideDown(360); }, function () { $(".Header-drop").stop().slideUp(300) }); } var headerDropMb = function () { $(".Header-arrow").click(function () { if ($(this).next(".Header-dropMb").is(':hidden')) { $(".Header-arrow").removeClass('active'); $(".Header-dropMb").slideUp(240); $(this).addClass('active'); $(this).next(".Header-dropMb").slideDown(280); } else { $(this).removeClass('active'); $(this).next(".Header-dropMb").slideUp(240); } }); $('.Header-dropMb a').click(function () { $(this).parent().slideUp(300).parent().find('.Header-arrow').removeClass('active'); $('.Header-navclick').removeClass('active'); $('.Header-wrapper').removeClass('mb'); $(this).removeClass('active'); $('.Header-navbar').fadeOut(300).removeClass("active"); $("body,html").css({ "overflow": "" }); }) } var footerDropMb = function () { if (window.innerWidth >= 1000) { return false; } $(".Footer-menu").click(function () { if ($(this).next(".Footer-drop").is(':hidden')) { $(".Footer-menu").removeClass('active'); $(".Footer-drop").slideUp(240); $(this).addClass('active'); $(this).next(".Footer-drop").slideDown(280); } else { $(this).removeClass('active'); $(this).next(".Footer-drop").slideUp(240); } }); } var sonMenu = function (f, s) { if ($(s).length <= 0 || window.innerWidth >= 680) { return false; } var menuWidth = 0; var menuMargin = parseInt($(s).find("li").css('marginRight')); $(s).find("li").each(function () { menuWidth += $(this)[0].getBoundingClientRect().width + menuMargin; }); $(s).width(menuWidth - menuMargin); var ontrueLeft; if ($(s).find("li").hasClass("active")) { ontrueLeft = $(s).find("li.active").offset().left - menuMargin } else { ontrueLeft = 0 } setTimeout(function () { $(f).animate({ 'scrollLeft': menuWidth - $(window).width() }, 800).after().animate({ 'scrollLeft': ontrueLeft }, 800) }, 800); } var langFn = function () { if (window.innerWidth >= 1000) { $(".Header-lang").hover(function () { $(this).addClass("active"); }, function () { $(this).removeClass("active"); }); } else { $(".Header-lang").click(function (e) { if ($(".Header-navclick").length > 0) { $('.Header-navclick').removeClass('active'); $('.Header-navbar').hide().removeClass("active"); $("body,html").css({ "overflow": "" }); $('.Header-wrapper').removeClass('mb')} if ($(".Header-search-click").length > 0) { $(".Header-search-click").removeClass("active"); $(".Header-search-item").removeClass("active"); $("body").removeClass("onSearch"); } if (!$(this).hasClass("active")) { $(this).addClass("active"); $(".Header-lang-more").show(); } else { $(this).removeClass("active"); $(".Header-lang-more").hide(); } e.stopPropagation(); }); $(window).click(function () { $(".Header-lang-more").hide(); $(".Header-lang").removeClass("active"); }); } } var backTop = function () { $(window).scroll(function () { if ($(window).scrollTop() > 200) { $('.backTop').fadeIn(300); } else { $('.backTop').fadeOut(200); } }); var isClick = true; $(".backTop").click(function () { if (isClick && $(window).scrollTop() > 0) { isClick = false; $("html,body").animate({ scrollTop: "0px" }, 800); } setTimeout(function () { isClick = true; }, 800); }); } var videoPlay = function () { // 瑙嗛寮圭獥 $(".videoPlay").click(function () { var url = $(this).attr("videoSrc"); if (url != "" && url != undefined) { if (url.indexOf('http') == 0) { if (url.indexOf('mp4') == -1) { $(".popVideo-video").html('') } else { $(".popVideo-video").html('') } } else { $(".popVideo-video").html('') } $(".popVideo").addClass("active"); } }); $(".popVideo-close").click(function () { $(".popVideo").removeClass("active"); $(".popVideo-video").html(""); }); } // 鎵ц鍑芥暟 ****************************************************************************************************************************** $(function () { popIE(); // 鍒ゆ柇IE鐗堟湰鎻愮ず equipmentFn(); // body-class璁惧淇℃伅 mbPenetrate("navbarScroll"); //绉诲姩绔姝㈢┛閫 浼犲叆class headerLi(); //绉诲姩绔鑸嚭鍦哄姩鐢 banDrag(); //绂佹鍥剧墖銆乤鏍囩鎷栧姩 navbarFn(); //绉诲姩绔眽鍫¢敭 searchFn(); //鎼滅储 headerDrop(); //瀵艰埅涓嬫媺 headerDropMb(); //绉诲姩绔?瀵艰埅涓嬫媺 footerDropMb(); //绉诲姩绔?搴曢儴瀵艰埅涓嬫媺 langFn(); //璇█ backTop(); //缃《 videoPlay(); lyb(); // sonMenu(".caseO-tab",".caseO-tab ul"); //绉诲姩绔?鍐呴〉鑿滃崟("瀹氫箟overflow-x: auto鐨勭埗鍏冪礌","璁剧疆瀹藉害鐨勫瓙鍏冪礌") }); // 鍏ㄥ眬鍑芥暟 ****************************************************************************************************************************** // 鏁板瓧鍓嶉潰琛?锛屼娇鐢 $.prefixInteger(num,length) jQuery.prefixInteger = function (num, length) { return (Array(length).join('0') + num).slice(-length); } // 绐楀彛浜嬩欢 ****************************************************************************************************************************** $(window).resize(function () { equipmentFn();// body-class璁惧淇℃伅 }); // 婊氬姩浜嬩欢 ****************************************************************************************************************************** $(window).scroll(function () { }); }());