// 10.21 start $(function () { redirectbylang(); //20210830 漏洞 $(".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(); xlSearch(); initNavLine(); // 点击遮罩层收起 $('.load-mask').click(function (e) { e.stopPropagation(); $('.point').removeClass('active') $('.xialaph').stop().slideUp() $('.phonemeng').removeClass('active') $('html').removeClass('modal-open') $('.load-mask').stop().fadeToggle() // 收起右边 $('.sub-nav').slideUp() // 把左边颜色和选中去掉 $('.ul1') .children() .children() .children() .removeClass('nav-active') .children('a') .removeClass('nav-a-active') $('.ul1').children().children().children().find('.active-line').hide() // 关闭弹窗还原三级菜单的样式 if (!$('html').hasClass('modal-open')) { $('.sub-nav-icon') .find('img') .attr('src', '../../templates/leewelltech/image/mob/nav/arrow-down.png') $('.sub-nav-container > li').removeClass('isopen') } if ($('.search-float').css('display') != 'none') { $('.search-float').css('display', 'none') } }) }); 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; } //判断是否有language cookie var haslang = false; var isenglish = false; if($.cookie('language')) { haslang = true; if($.cookie('language').indexOf("en") > -1){ //判断是否之前存的en的cookie 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 ,waf和cdn无法获取来源 $.cookie('language', 'en',{path:"/"}); window.location.href = "http://" + host + "/html/en/"; return false; } } //设置cookie $.cookie('language', 'cn',{path:"/"}); //显示首页body $("body").css("visibility","visible"); }else{ //如果不是本地来路且cookie存的英文 if(!islocal && isenglish){ window.location.href = "http://"+host+"/html/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"); $('.xialaph').css('height', '440px') // 11.19 $(this).find('.point').toggleClass('active') $('.xialaph').stop().slideToggle() $('.phonemeng').toggleClass('active') $('html').toggleClass('modal-open') $('.load-mask').fadeToggle() // 收起右边 $('.sub-nav').slideUp() // 把左边颜色和选中去掉 $('.ul1') .children() .children() .children() .removeClass('nav-active') .children('a') .removeClass('nav-a-active') $('.ul1').children().children().children().find('.active-line').hide() // 关闭弹窗还原三级菜单的样式 if (!$('html').hasClass('modal-open')) { $('.sub-nav-icon') .find('img') .attr('src', '../../templates/leewelltech/image/mob/nav/arrow-down.png') $('.sub-nav-container > li').removeClass('isopen') } let isEn = window.location.pathname && window.location.pathname.includes('en'); let search = window.location.search || ''; let searchList = search.split('tid=')[1] ? search.split('tid=') : (!search.split('tid=')[1] ? search.split('did=') : []) || [] let aboutCompanyPage = isEn ? ['85'] : ['45']; let newsPage = isEn ? ['79', '80'] : ['61', '62']; let solutionPage = isEn ? ['86', '87', '88', '89'] : ['74', '75', '76', '77']; let productPage = isEn ? ['127', '128', '129', '130'] : ['96', '97', '98', '99']; let servicePage = isEn ? ['95'] : ['54']; // 如果是首页则默认选中首页,且右边不出现东西 if (!search && $(e.target).eq(0).hasClass('active')) { $('.ul1') .children() .children() .children('h4') .eq(0) .find('.active-line') .slideDown() $('.ul1') .children() .children() .children('h4') .eq(0) .addClass('nav-active') $('.ul1') .children() .children() .children('h4') .eq(0) .children('a') .addClass('nav-a-active') } else { let idx = 0 if (search && aboutCompanyPage.includes(searchList[1])) { idx = 1 } else if (search && newsPage.includes(searchList[1])) { idx = 2 } else if (search && solutionPage.includes(searchList[1])) { idx = 3 } else if (search && productPage.includes(searchList[1])) { idx = 4 } else if (search && servicePage.includes(searchList[1])) { idx = 5 } $('.ul1') .children() .children() .children('h4') .eq(idx) .find('.active-line') .slideDown() $('.ul1') .children() .children() .children('h4') .eq(idx) .addClass('nav-active') $('.ul1') .children() .children() .children('h4') .eq(idx) .children('a') .addClass('nav-a-active') } // 默认进来所有下拉隐藏 $('.submenu').hide() if ($('.sub-nav-container > li').hasClass('no-submenu')) { $('.sub-nav-container > li') .children('.sub-nav-icon') .find('img') .hide() $('.sub-nav-container > li') .siblings('li') .children('.sub-nav-icon') .find('img') .hide() } // 手风琴 $('.sub-nav-container > li') .unbind('click') .bind('click', function (e) { if ($(this).hasClass('no-submenu')) { return } $(this).next('.submenu').slideToggle() $(this).siblings('li').next('.submenu').slideUp() // 增加这个类只是为了区分展开的项 $(this) .toggleClass('isopen') .siblings('li') .removeClass('isopen') if ($(this).hasClass('isopen')) { $(this) .children('.sub-nav-icon') .find('img') .attr('src', '../../templates/leewelltech/image/mob/arrow-up.png') $(this) .siblings('li') .children('.sub-nav-icon') .find('img') .attr('src', '../../templates/leewelltech/image/mob/arrow-down.png') } else { $(this) .children('.sub-nav-icon') .find('img') .attr('src', '../../templates/leewelltech/image/mob/arrow-down.png') } }) $('.submenu > li') .unbind('click') .bind('click', function (e) { e.stopPropagation() }) return }) // ph导航二级 $('.xialaph h4').click(function (e) { // 首页右边没东西 if (!$(e.target).text().includes('首页')) { // 选中的对应的右边内容 $(this).parent().children('.sub-nav').slideDown() $(this).parent().parent().siblings().find('.sub-nav').hide() } else { $('.sub-nav').slideUp() } if ( $(this) .siblings('.sub-nav') .children('.sub-nav-container') .children('li') .hasClass('no-submenu') ) { $(this) .siblings('.sub-nav') .children('.sub-nav-container') .children('li') .children('.sub-nav-icon') .find('img') .hide() $(this) .siblings('.sub-nav') .children('.sub-nav-container') .children('li') .siblings('li') .children('.sub-nav-icon') .find('img') .hide() } else { $(this) .siblings('.sub-nav') .children('.sub-nav-container') .children('li') .children('.sub-nav-icon') .find('img') .show() $(this) .siblings('.sub-nav') .children('.sub-nav-container') .children('li') .siblings('li') .children('.sub-nav-icon') .find('img') .show() } // 选中的线段出现 $(this).find('.active-line').slideDown() $(this).parent().parent().siblings().find('h4').find('span').hide() // 选中的背景出现 $(this) .parent() .parent() .siblings() .find('h4') .removeClass('nav-active') $(this).addClass('nav-active') // 选中的颜色 $(this) .parent() .parent() .siblings() .find('h4') .children('a') .removeClass('nav-a-active') $(this).children('a').addClass('nav-a-active') return 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() }) } // 初始化导航栏的线条 function initNavLine () { $('.mc_nav_li').removeClass('zdpc-nav-active'); let isEn = window.location.pathname && window.location.pathname.includes('en'); let search = window.location.search || ''; let searchList = search.split('tid=')[1] ? search.split('tid=') : (!search.split('tid=')[1] ? search.split('did=') : []) || []; let aboutCompanyPage = isEn ? ['85', '81'] : ['45']; let newsPage = isEn ? ['79', '80'] : ['61', '62']; let solutionPage = isEn ? ['86', '87', '88', '89'] : ['74', '75', '76', '77']; let productPage = isEn ? ['127', '128', '129', '130'] : ['96', '97', '98', '99']; let servicePage = isEn ? ['95'] : ['54']; let idx = 0; // 如果是首页 if (!search) { idx = 0 } else { if (search && aboutCompanyPage.includes(searchList[1])) { idx = 1 } else if (search && newsPage.includes(searchList[1])) { idx = 2 } else if (search && solutionPage.includes(searchList[1])) { idx = 3 } else if (search && productPage.includes(searchList[1])) { idx = 4 } else if (search && servicePage.includes(searchList[1])) { idx = 5 } } $('.mc_nav_li').eq(idx).addClass('zdpc-nav-active').siblings().removeClass('zdpc-nav-active'); } // 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') $('.mc_logo_def').attr("src", "/templates/leewelltech/image/lleewelltech_logo.svg" ); $('.mc_logo_fixed').attr("src", "/templates/leewelltech/image/lleewelltech_logo.svg" ); } else { $('.mc_logo_def').attr("src", "/templates/leewelltech/image/lleewelltech_logo_white.svg" ); $('.mc_logo_fixed').attr("src", "/templates/leewelltech/image/lleewelltech_logo_white.svg" ); if ($('.mc_navbar').hasClass('hovernow')) { $('.mc_logo_def').attr("src", "/templates/leewelltech/image/lleewelltech_logo.svg" ); $('.mc_logo_fixed').attr("src", "/templates/leewelltech/image/lleewelltech_logo.svg" ); return } $('.mc_navbar').removeClass('mc_fixed') } } $('.mc_navbar').hover( function () { $(this).addClass('hovernow') $('.mc_logo_def').attr("src", "/templates/leewelltech/image/lleewelltech_logo.svg" ); $('.mc_logo_fixed').attr("src", "/templates/leewelltech/image/lleewelltech_logo.svg" ); if ($(window).scrollTop() == 0) { $(this).addClass('mc_fixed mc_nav_hover') } }, function () { $(this).removeClass('hovernow') // 鼠标移出,需要展示灰色字 $('.mc_logo_def').attr("src", "/templates/leewelltech/image/lleewelltech_logo.svg" ); $('.mc_logo_fixed').attr("src", "/templates/leewelltech/image/lleewelltech_logo.svg" ); if ($(window).scrollTop() == 0) { // 鼠标移出,需要展示灰色字,如果是顶部则继续展示白色字 $(this).removeClass('mc_fixed') $('.mc_logo_def').attr("src", "/templates/leewelltech/image/lleewelltech_logo_white.svg" ); $('.mc_logo_fixed').attr("src", "/templates/leewelltech/image/lleewelltech_logo_white.svg" ); } $(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') } ) $('.mc_subnav_li') .not('.yxnav_active1') .hover( function () { // if ($(window).scrollTop() == 0) { // $(".mc_navbar").addClass("mc_fixed") // } $(this).find('.mc_nav_xl-3').stop().slideDown().addClass('show') $('.mc_nav_xl-3.yxnav_active1') .find('.mc_nav_xl-3') .addClass('xlhide') }, function () { // if ($(window).scrollTop() == 0) { // $(".mc_navbar").removeClass("mc_fixed") // } $(this) .find('.mc_nav_xl-3') .stop() .slideUp() .removeClass('show') $('.mc_nav_xl-3.yxnav_active1') .find('.mc_nav_xl-3') .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() }) } } // 动态修改移动端轮播icon的width function initSwiperIconWid(swiperWarp) { let slideList = $(swiperWarp) .children('.swiper-wrapper') .children('.swiper-slide') $.each(slideList, function (idx, obj) { let iconNum = $(obj) .children('.slide-content') .children('.slide-btm') .children('.slide-btm-features') .children().length let wid = (100 / iconNum).toFixed(1) $(obj) .children('.slide-content') .children('.slide-btm') .children('.slide-btm-features') .children() .css('width', `${wid}%`) }) } //导航hover效果 $(function () { $('.mc_nav_li').click(function () { $(this).addClass('zdpc-nav-active').siblings().removeClass('zdpc-nav-active') }) }) 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和width参数 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 = '