var tools = { scrollDiy: function (event) { if ($(".wdz-scroll") && $(".wdz-scroll").length != 0) { var e = event || window.event; $(".wdz-scroll").mCustomScrollbar({ scrollButtons: { enable: false } }) $(".wdz-scroll2").mCustomScrollbar({ scrollButtons: { enable: false }, horizontalScroll: true }) } }, closeScrollFn: function (obj) { obj.removeClass("wdz-scroll"); obj.mCustomScrollbar("destroy"); }, htmlsize: function () { var dw = 750; var ww = $(window).width(); console.log("w", ww) var maxw = 1920; var minw = 320; if ($(window).width() > maxw) { ww = maxw; } else if ($(window).width() < minw) { ww = minw; } $("html").css({ fontSize: Math.floor((ww / dw) * 100) }); }, _debounce: function (func, wait, immediate) { var timeout; return function () { clearTimeout(timeout); timeout = setTimeout(func, wait) } }, // 产品导航 productNavFn: function (tar) { var sto_nav1; $(".hRight ul li.productCode").hover(function () { $(".proMenuBox").addClass("active") }, function () { sto_nav1 = setTimeout(function () { $(".proMenuBox").removeClass("active"); }, 100); }); $(".proMenuBox").hover(function(){ clearTimeout(sto_nav1); },function(){ $(".proMenuBox").removeClass("active"); }) $(".proMenuTab .item").click(function(){ var index = $(this).index(); $(".proMenuList .listOut").eq(index).show().siblings().hide(); }) }, ybSwiperHistory: function (tar) { // 发展历程 if (tar && tar != "") { try { var proSwiper = new Swiper('.pro-swiper', { slidesPerView: 3, watchSlidesVisibility: true, }); } catch (e) { console.log(e) } var mySwiper = new Swiper('.ybHistory_swiper', { slidesPerView: 1, spaceBetween: 40, simulateTouch: false, thumbs: { swiper: proSwiper }, breakpoints: { 640: { slidesPerView: 1, spaceBetween: 30 }, 750: { slidesPerView: 2, spaceBetween: 40 }, 860: { slidesPerView: 3, spaceBetween: 30 }, 1000: { slidesPerView: 3, spaceBetween: 40 }, 1200: { slidesPerView: 3, spaceBetween: 60 } } }); var num = 0; $(".bb-wrap").removeClass("bb-sel"); $(".bb-wrap").eq(num).addClass("bb-sel"); if (num == 0) { $(".h_prev").addClass("bb-dis"); } $(".h_prev").on("click", function () { $(".h_next").removeClass("bb-dis"); if (num <= 0) { num = 0; $(".h_prev").addClass("bb-dis"); mySwiper.slideTo(0); return false; } else { if (num == 1) { $(".h_prev").addClass("bb-dis"); } mySwiper.slidePrev(); } num--; $(".bb-wrap").removeClass("bb-sel"); $(".bb-wrap").eq(num).addClass("bb-sel"); }); $(".h_next").on("click", function () { $(".h_prev").removeClass("bb-dis"); if (num >= $(".bb-wrap").length - 1) { $(".h_next").addClass("bb-dis"); return false; } else { if (num >= $(".bb-wrap").length - 2) { $(".h_next").addClass("bb-dis"); } mySwiper.slideNext(); } num++; $(".bb-wrap").removeClass("bb-sel"); $(".bb-wrap").eq(num).addClass("bb-sel"); }); $(".bb-wrap").each(function (index) { $(this).on("click", function () { $(".bb-wrap").removeClass("bb-sel"); $(".bb-wrap").eq(index).addClass("bb-sel"); num = index; if (index == 0) { $(".h_next").removeClass("bb-dis"); $(".h_prev").addClass("bb-dis"); } else if (index == $(".bb-wrap").length - 1) { $(".h_prev").removeClass("bb-dis"); $(".h_next").addClass("bb-dis"); } else { $(".h_prev").removeClass("bb-dis"); $(".h_next").removeClass("bb-dis"); } }); }); } // 发展历程 END }, mHonorSwiperFn: function (tar) { if (tar && tar.length != 0) { var galleryThumbs = new Swiper('.mHonorList_sw', { spaceBetween: 16, slidesPerView: 4, freeMode: true, watchSlidesVisibility: true, watchSlidesProgress: true, navigation: { nextEl: '.honor-button-next', prevEl: '.honor-button-prev', }, breakpoints: { 640: { slidesPerView: 4, spaceBetween: 24 }, 750: { slidesPerView: 4, spaceBetween: 40 } } }); var galleryTop = new Swiper('.mHonorTopBox_top', { spaceBetween: 10, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, pagination: { el: '.swiper-pagination', type: 'fraction', }, thumbs: { swiper: galleryThumbs }, on:{ init:function(){ var ww = $(window).width(); if(ww<750){ $(".mHonorTopBox_top .swiper-slide").eq(this.activeIndex).find(".txtBox").mCustomScrollbar({ scrollButtons: { enable: false } }) } }, slideChangeTransitionEnd:function(){ var ww = $(window).width(); if(ww<750){ $(".mHonorTopBox_top .swiper-slide").eq(this.activeIndex).find(".txtBox").mCustomScrollbar({ scrollButtons: { enable: false } }) } } } }); $(".honor-button-prev").click(function () { galleryTop.slidePrev(); }) $(".honor-button-next").click(function () { galleryTop.slideNext(); }) } }, mNavSwiperFn1: function (tar) { if (tar && tar.length != 0) { var mNavSwiper2 = new Swiper('.mNavSwiper1', { slidesPerView: "auto", spaceBetween: 0, initialSlide: $(".mNavSwiper1 .swiper-slide.active").attr("data-num"), watchOverflow: true, centerInsufficientSlides: true, }); } }, tzzTabFn: function (tar) { if (tar && tar.length != 0) { var mNavSwiper3 = new Swiper('.tzzTab .swiper-container', { // slidesPerView: 4.2, slidesPerView: "auto", spaceBetween: 10, initialSlide: $(".tzzTab .swiper-container .swiper-slide.active").attr("data-num"), watchOverflow: true, // centerInsufficientSlides: true, breakpoints:{ 750: { spaceBetween: 20 }, 860: { spaceBetween: 25 }, 980: { spaceBetween: 30 }, 1180: { spaceBetween: 40 } } }); } }, searchFn: function (tar) { if (tar && tar.length != 0) { tar.click(function () { $(".ejSearchBox").addClass("active"); $(".topHeader").addClass("addBg") }) } }, searchCloseFn: function (tar) { if (tar && tar.length != 0) { tar.click(function () { $(".ejSearchBox").removeClass("active"); $(".topHeader").removeClass("addBg") }) } }, // 搜索方法 singleSearch: function (tar) { if (tar && tar.length != 0) { var defHref = tar.attr("href"); $(".searchList ul li a").off().on("click",function(){ var _text = $(this).text(),_type = $(this).attr("data-type"); var _url = $(this).attr("data-url"); console.log(_url,"=====",_text) $(".searchList .txtBox span").text(_text) tar.attr("href",_url).attr("data-searchType",_type) defHref = _url; }) tar.on("click", function (e) { if ($("#textfield").val() == "" || $("#textfield").val() == null) { $("#textfield").val(""); } //核心代码,拼接参数 console.log("0000",tar.attr("data-searchType")) if(tar.attr("data-searchType")==1){ tar.attr("href", defHref + '?keyword='+encodeURI($.trim($("#textfield").val()))); }else{ var args = "siteIds=" + window.btoa(tar.attr("data-siteIds")) + "&excludeCategoryId=" + window.btoa(tar.attr("data-excludeCategoryId")) + "&dataUrl=" + window.btoa(tar.attr("data-url")) + "&keyword=" + encodeURI(encodeURI($.trim($("#textfield").val()))); //核心代码,拼接参数 end tar.attr("href", defHref + '#' + args); } $("#searchword").val(""); // window.open(tar.attr("href")); $(".ejSearchBox").removeClass("active") // $(".hr-search-mask").show(); $("#textfield").val(""); }); $("#textfield").keyup(function (e) { if (e.keyCode == 13) { if ($("#textfield").val() == "" || $("#textfield").val() == null) { $("#textfield").val(""); } else { tar.trigger("click"); window.open(tar.attr("href")); } } }); } }, rightMapFn:function(tar){ if (tar && tar.length != 0) { //rightMap $(".topLink .rightMap").click(function () { var ww = $(window).width(); if(ww>980){ $(".rightMapMenu,.sitepopup").addClass("active") }else{ $(".mNavBox").addClass("active") } }) $(".rightMapCloseBtn").click(function(){ $(".rightMapMenu,.sitepopup").removeClass("active") }) } }, // 二级导航 mNavSwiperFn: function (tar) { var mNavSwiper = new Swiper('.mNavSwiper', { // slidesPerView: 4.2, slidesPerView: "auto", spaceBetween: 0, initialSlide: $(".ybmNav .mshow .swiper-slide.active").attr("data-num"), }); }, // 三级导航 mNavSwiperFn3: function (tar) { var mNavSwiper = new Swiper('.mNavSwiper3', { // slidesPerView: 4.2, slidesPerView: "auto", spaceBetween: 0, initialSlide: $(".mNavSwiper3 .swiper-slide.active").attr("data-num"), }); }, init: function () { this.scrollDiy(); this.mHonorSwiperFn($(".mHistoryBox")) this.mNavSwiperFn1($(".mNavSwiper1")) this.ybSwiperHistory($(".ybHistoryList_in_sw")) this.searchFn($(".tSearchBtn")) this.searchCloseFn($(".search_close")) this.rightMapFn($(".rightMap")) this.productNavFn() this.singleSearch($("#submitbuttom")) this.mNavSwiperFn($(".mNavSwiper")) this.mNavSwiperFn3($(".mNavSwiper3")) this.tzzTabFn($(".tzzTab")) } } $(function () { tools.init() $(window).resize(tools.htmlsize); $(".services_listBox .RCMS_EDITOR table").each(function(){ $(this).wrap("
") // var _this = $(this) // setTimeout(function(){ // $(".table-responsive").mCustomScrollbar({ // scrollButtons: { // enable: false // }, // horizontalScroll: true // }) // }) }) })