// 10.21 start $(function () { redirectbylang(); $(".mc_botbox_btn").click(function () { $(".mc_botbox").stop().fadeOut(); $.cookie('isHide', 'true'); }); var isHide = $.cookie('isHide'); if (isHide) { $(".mc_botbox").stop().hide(); } else { $(".mc_botbox").stop().show(); } }); // 10.21end $(function () { // wow鍒濆鍖 new WOW().init(); // 鎵嬫満瀵艰埅涓嬫媺 phMenu(); mcCheckbox(); pcNav(); ftInit(); }); function redirectbylang() { var domain = window.location.href;//鑾峰彇褰撳墠鍦板潃 var host = window.location.host;//褰撳墠鍩熷悕 var ref = document.referrer; //鑾峰彇褰撳墠娴忚鍣ㄨ瑷€ var currentLang = navigator.language; if(!currentLang){ currentLang = navigator.browserLanguage; } //鍒ゆ柇鏄惁鏈塴anguage cookie var haslang = false; var isenglish = false; if($.cookie('language')) { haslang = true; if($.cookie('language').indexOf("en") > -1){ //鍒ゆ柇鏄惁涔嬪墠瀛樼殑en鐨刢ookie isenglish = true; } } //鍒ゆ柇鏄惁鏄潵婧愪簬鏈珯 var islocal = false; if(ref && ref.indexOf(host) > -1){ islocal = true; } //鍖哄垎鏄惁鏄埛鏂帮紙鍗虫湰椤甸潰鐐瑰嚮鍒锋柊锛屼篃涓虹粺涓€娴忚鍣ㄥ埛鏂版湁鏉ヨ矾鍜屽洖杞︽棤鏉ヨ矾闂锛 if(window.performance.navigation.type == 1){ islocal = false; } //鍒ゆ柇鏄惁鏄椤 浠呭湪棣栭〉鎵ц鎵€鏈夐€昏緫 if(domain == "https://"+host+"/" || domain == "http://"+host+"/"){ if(!haslang){//娌℃湁璇█cookie //鍒ゆ柇娴忚鍣ㄨ瑷€鏄惁鏄腑鏂 if(currentLang.indexOf("zh") == -1){ if(!islocal) { //澶囨敞锛氶€氳繃 window.location.href 锛寃af鍜宑dn鏃犳硶鑾峰彇鏉ユ簮 $.cookie('language', 'en',{path:"/"}); window.location.href = "http://" + host + "/en/"; return false; } } //璁剧疆cookie $.cookie('language', 'cn',{path:"/"}); //鏄剧ず棣栭〉body $("body").css("visibility","visible"); }else{ //濡傛灉涓嶆槸鏈湴鏉ヨ矾涓攃ookie瀛樼殑鑻辨枃 if(!islocal && isenglish){ window.location.href = "http://"+host+"/en/"; }else{ //鏄剧ず棣栭〉body $("body").css("visibility","visible"); $.cookie('language', 'cn',{path:"/"}); } } } } // 鎵嬫満瀵艰埅涓嬫媺 function phMenu() { // ph瀵艰埅 $(".mc_ph_menu").click(function (e) { e.stopPropagation(); // 11.19 var h = window.innerHeight - 64; $(".xialaph").css("height", h + "px"); // 11.19 $(this).find(".point").toggleClass("active"); $(".xialaph").stop().slideToggle(); $(".phonemeng").toggleClass('active'); $("html").toggleClass("modal-open") // $("body,html").animate({ // scrollTop: 0 // }, 500); }); // ph瀵艰埅浜岀骇 $(".xialaph h4").click(function (e) { if ($(e.target).hasClass("g_phnav1")) { return; } if ($(this).parents("li").hasClass("mc_phnav_hasnosub")) { return; } $(this).siblings(".ul2").stop().slideToggle(); $(this).parent().parent().siblings().find(".ul2").stop().slideUp(); $(this).toggleClass("active"); $(this).parent().parent().siblings().find("h4,h5").removeClass('active'); }); /*ph瀵艰埅涓夌骇*/ $(".xialaph h5").click(function () { $(this).siblings(".ul3").stop().slideToggle(); $(this).parent().siblings().find(".ul3").stop().slideUp(); $(this).toggleClass("active"); $(this).parent().siblings().find("h4,h5").removeClass('active'); }); $(".ul1>li").each(function () { if ($(this).find(".ul2 li").length == 0) { $(this).addClass("mc_phnav_hasnosub"); } }) $(".xialaph h4 a").click(function (e) { e.stopPropagation }); } // checkbox function mcCheckbox() { $(".mc_ly_checkbox").find("input").click(function (e) { e.stopPropagation(); }) $(".mc_ly_checkbox").click(function () { $(this).find("input").click(); }) //鍗曢€ 2021.1.26 mark $(".mc_ly_yycj .mc_ly_checkbox").click(function () { $(this).siblings().find("input[type=checkbox]").removeAttr("checked"); }) } // 閿氱偣 function yxtop() { $(window).load(function () { var test = (window.location.href).split('tp/'); if (!isNaN(test[1])) { $("html,body").animate({ scrollTop: $('[yxdatop-pag="' + test[1] + '"]').offset().top - 90 }, 700); } }) }; // pc瀵艰埅鐩稿叧 function pcNav() { // 瀵艰埅鍚搁《 navFixed(); $(window).scroll(function () { navFixed(); }) function navFixed() { if ($(window).scrollTop() > 0) { $(".mc_navbar").addClass("mc_fixed") } else { if ($(".mc_navbar").hasClass("hovernow")) { return; } $(".mc_navbar").removeClass("mc_fixed") } } $(".mc_navbar").hover( function () { $(this).addClass("hovernow"); if ($(window).scrollTop() == 0) { $(this).addClass("mc_fixed mc_nav_hover") } }, function () { $(this).removeClass("hovernow"); if ($(window).scrollTop() == 0) { $(this).removeClass("mc_fixed") } $(this).removeClass("mc_nav_hover") } ) // 浜岀骇涓嬫媺 $(".mc_nav_li").not(".yxnav_active1").hover( function () { // if ($(window).scrollTop() == 0) { // $(".mc_navbar").addClass("mc_fixed") // } $(this).find(".mc_nav_xl").stop().slideDown().addClass("show"); $(".mc_nav_li.yxnav_active1").find(".mc_nav_xl").addClass("xlhide"); }, function () { // if ($(window).scrollTop() == 0) { // $(".mc_navbar").removeClass("mc_fixed") // } $(this).find(".mc_nav_xl").stop().slideUp().removeClass("show"); $(".mc_nav_li.yxnav_active1").find(".mc_nav_xl").removeClass("xlhide"); } ) // 鎼滅储涓嬫媺 var isShow = false; $(".mc_search").click(function (e) { e.stopPropagation(); if (!isShow) { $(this).addClass("isshow"); $(this).find(".mc_search_xl").stop().slideDown().addClass("show"); isShow = true; } else { $(this).removeClass("isshow"); $(this).find(".mc_search_xl").stop().slideUp().removeClass("show"); isShow = false; } }) $(".mc_search_xl").click(function (e) { e.stopPropagation(); }) $(".mc_search_xl").mouseleave(function () { $(this).parents(".mc_search").removeClass("isshow"); $(this).stop().slideUp().removeClass("show"); isShow = false; }) } //搴曢儴鐩稿叧 function ftInit() { // 搴曢儴浜岀淮鐮佹樉绀 if ($(window).width() > 1200) { //$(".mc_ft1_qrbox").hover( // function () { // $(this).find(".mc_ft1_qrxl").stop().slideDown(); // }, // function () { // $(this).find(".mc_ft1_qrxl").stop().slideUp(); // } //) } else { $(".mc_ft1_qrbox").click(function (e) { e.stopPropagation(); $(this).siblings().find(".mc_ft1_qrxl").stop().slideUp(); $(this).find(".mc_ft1_qrxl").stop().slideToggle(); }); $("body").click(function () { $(".mc_ft1_qrxl").stop().slideUp(); }) } } //瀵艰埅hover鏁堟灉 $(function () { // navHover(); }); function navHover() { var $line = $('') if ($(".mc_nav_line").length < 1) { $(".mc_nav").append($line); } var linePara = { widthArr: [], leftArr: [], leftAct: 0, widthAct: 0, } getLinePara(); lineInit(); $(window).load(function () { getLinePara(); lineInit(); }) $(window).resize(function () { getLinePara(); lineInit(); }) $(".mc_nav_li").hover( function () { var index = $(this).index(); setLinePara(linePara.leftArr[index], linePara.widthArr[index]); }, function () { lineInit(); } ) // 绾垮垵濮嬪寲 function lineInit() { setLinePara(linePara.leftAct, linePara.widthAct); } // 鑾峰彇绾跨殑left鍜寃idth鍙傛暟 function getLinePara() { linePara.widthArr = []; linePara.leftArr = []; $(".mc_nav>.mc_nav_li").each(function () { var itemLeft = $(this).position().left linePara.leftArr.push(itemLeft); var itemWidth = $(this).outerWidth(); linePara.widthArr.push(itemWidth); if ($(this).hasClass("yxnav_active1")) { linePara.leftAct = itemLeft; linePara.widthAct = itemWidth; } }) } //璁惧畾绾跨殑鍙傛暟 function setLinePara(itemLeft, itemWidth) { $line.css({ left: itemLeft, width: itemWidth, }) } } //寰€涓婄Щ鍔ㄦ晥鏋 $(function () { dataTable(); }) $(window).load(function () { dataTable(); }) function dataTable() { if ($(".mc_data_td").length > 0) { var dataTopArr = []; getTopArr(); isDataShow(); $(window).resize(function () { getTopArr(); }) $(window).scroll(function () { isDataShow(); }) // 鍒ゆ柇鏄惁鏄剧ず function isDataShow() { for (var i = 0; i < dataTopArr[length]; i++) { if ($(window).scrollTop() > dataTopArr[i]) { $(".mc_data_td").eq(i).addClass("active"); } else { $(".mc_data_td").eq(i).removeClass("active"); } } } // 鑾峰彇鍏冪礌璺濈椤堕儴鐨勯珮搴 function getTopArr() { $(".mc_data_td").each(function (index) { var itemIndex = index; var itemTop = $(this).offset().top - $(window).height() / 1.5; dataTopArr[itemIndex] = itemTop; }) } } } //寰€涓婄Щ鍔ㄦ晥鏋 $(function () { g1List(); }) $(window).load(function () { g1List(); }) function g1List() { if ($(".mc_g1_li").length > 0) { var dataTopArr = []; getTopArr(); isDataShow(); $(window).resize(function () { getTopArr(); }) $(window).scroll(function () { isDataShow(); }) // 鍒ゆ柇鏄惁鏄剧ず function isDataShow() { for (var i = 0; i < dataTopArr[length]; i++) { if ($(window).scrollTop() > dataTopArr[i]) { $(".mc_g1_li").eq(i).addClass("active"); } else { $(".mc_g1_li").eq(i).removeClass("active"); } } } // 鑾峰彇鍏冪礌璺濈椤堕儴鐨勯珮搴 function getTopArr() { $(".mc_g1_li").each(function (index) { var itemIndex = index; var itemTop = $(this).offset().top - $(window).height() / 1.5; dataTopArr[itemIndex] = itemTop; }) } } } // 鏇村妗堜緥 function moreCase() { var tool = '
' + '
' + '' + 'MORE' + '
' + '
' + '' + '
' + '
' $(".mc_btn_list").each(function () { if ($(this).find(".mc_btn_li").length > 4) { $(this).append(tool); } }) $(".mc_btn_list").on("click", ".mc_btn_show", function () { $(this).hide().parent(".mc_btn_toggle").siblings(".mc_btn_li").css("display", "inline-block"); $(this).siblings(".mc_btn_hide").show(); }); $(".mc_btn_list").on("click", ".mc_btn_hide", function () { $(this).hide().parent(".mc_btn_toggle").siblings(".mc_btn_li:gt(3)").hide(); $(this).siblings(".mc_btn_show").show(); }); } //20210702涓嬫媺 $(function () { globleXl(); }) function globleXl() { if ($(window).width() > 1024) { $(".mc1_area").hover( function () { $(this).addClass("act"); $(".mc1_area_second").stop().slideDown(); if ($(".mc_search").hasClass("isshow")) { $(".mc_search").trigger("click"); } ; }, function () { $(this).removeClass("act"); $(".mc1_area_second").stop().slideUp(); } ); $(".mc1_area_sec_li").hover( function () { $(this).find(".mc1_area_third").stop().fadeIn(); }, function () { $(this).find(".mc1_area_third").stop().fadeOut(); } ) } else { $(".mc1_area").click(function (e) { e.stopPropagation(); $(this).toggleClass("act"); }); $(".mc1_area_sec_li").click(function (e) { e.stopPropagation(); $(this).find(".mc1_area_third").stop().fadeToggle(); }); $(".mc1_area_second").click(function (e) { e.stopPropagation(); }) $(".mc1_area_back").click(function () { $(".mc1_area").removeClass("act"); }); $(".mc_ph_menu").click(function () { $(".mc1_area").removeClass("act"); }); } }; // 2022.3.4 (function(window){ var myScrollbar; if(window.myScrollbar){ myScrollbar=window.myScrollbar }; myScrollbar={ $html:$("html"), $body:$("body"), originalBodyPad:null, scrollbarWidth:0, hide:function(){ this.$body = $("body"); this.checkScrollbar(); this.setScrollbar(); this.$html.css("overflow","hidden"); }, show:function(){ this.$body = $("body"); this.$html.removeAttr("style"); this.resetScrollbar() }, checkScrollbar:function(){ var fullWindowWidth=window.innerWidth; if(!fullWindowWidth){ var documentElementRect=document.documentElement.getBoundingClientRect(); fullWindowWidth=documentElementRect.right-Math.abs(documentElementRect.left) } this.bodyIsOverflowing=document.body.clientWidth