$(function () { var ie = IEVersion() if (ie < 12) { window.location = 'https://support.dmeng.net/upgrade-your-browser.html' } chktop() chkFooterHelp() $(window).scroll(function () { chktop() chkFooterHelp() }) setTimeout(function () { $('.content img').css({ 'max-width': '100%', width: '', height: '' }) $('.content table').css({ 'max-width': '100%', width: '', height: '' }) }, 400) $(".searOpen").click(function () { $(".sear-main").toggleClass("cur") }) $(".menuChange").click(function () { $("#menuBool").toggleClass("active") $(".sykui-menu").toggleClass("exit-open") }) $(".main-soclal .soclal-list .item:nth-child(1)").addClass('cur') $(".main-soclal .soclal-list .item").hover(function () { $(".main-soclal .soclal-list .item").removeClass('cur') $(this).addClass('cur') } ) $(".hrefPoint a").click(function () { let that = $(this) let _id = that.data('id') topMao("#" + _id) setTimeout(function () { //console.log('栏目点击滚动重构', _id) $(".hrefPoint a").removeClass('cur') that.addClass('cur') }, 399) }) // 二级菜单 $(".header-pc a").hover(function(){ var index = $(this).index(); $(".subnav-container .subNav-content").hide(); $(".subnav-container .subNav-content").eq(index).show(); $(".subnav-first li").removeClass("on"); $(".subnav-second1 li").removeClass("on"); $(".subnav-second2 li").removeClass("on"); $(".subnav-cybj-container").eq(0).show().siblings().hide(); $(".subnav-second-container").eq(0).show().siblings().hide(); $(".subnav-second-container").eq(0).find(".subnav-second2 ul").hide(); $(".subnav-second-container").eq(0).find(".subnav-second2 ul").eq(0).show(); $(".subnav-other1 li").removeClass("on"); $(".subnav-other3").eq(0).show().siblings().hide();//三级菜单 },function(){ $(".subnav-container .subNav-content").hide(); }); $(".subnav-container .subNav-content").hover(function(){ $(this).show(); },function(){ $(this).hide(); }); $(".subnav-cybj-container").eq(0).show().siblings().hide();//右侧菜单 $(".subnav-second-container").eq(0).show().siblings().hide();//二级菜单 $(".subnav-first li").hover(function(){ var index1 = $(this).index(); //console.log(index1) $(this).addClass("on").siblings().removeClass("on"); $(".subnav-second-container").eq(index1).show().siblings().hide();//二级菜单 $(".subnav-cybj-container").eq(index1).show().siblings().hide();//右侧菜单 $(".subnav-second-container").eq(index1).find(".subnav-second2 ul").hide(); $(".subnav-second-container").eq(index1).find(".subnav-second2 ul").eq(0).show(); $(".subnav-second1 li").removeClass("on"); $(".subnav-second2 li").removeClass("on"); },function(){ }); $(".subnav-second2 ul").hide();//三级菜单 $(".subnav-second2 ul").eq(0).show();//三级菜单 $(".subnav-second1 li").hover(function(){ var index2 = $(this).index(); $(this).addClass("on").siblings().removeClass("on"); $(this).parent(".subnav-second1").siblings(".subnav-second2").find("ul").eq(index2).show().siblings().hide();//三级菜单 },function(){ }); $(".subnav-second2 li").hover(function(){ $(this).addClass("on").siblings().removeClass("on"); },function(){ }); // 除产品外其他二级导航 $(".subNav-content").each(function(index,ele){ $(this).find(".subnav-other3").eq(0).show().siblings().hide(); $(this).find(".subnav-other1 li").hover(function(){ var index3 = $(this).index(); //console.log(index3) $(this).addClass("on").siblings().removeClass("on"); $(this).parent('.subnav-other1').siblings(".subnav-other2").find(".subnav-other3").eq(index3).show().siblings().hide();//三级菜单 },function(){ }); $(this).find(".subnav-other3 li").hover(function(){ $(this).addClass("on").siblings().removeClass("on"); },function(){ $(".subnav-other3 li").removeClass("on"); }); }); $(".subNav-content").hover(function(){ var index4 = $(this).index(); $('.nav-container a').eq(index4).addClass("on"); },function(){ $('.nav-container a').removeClass("on"); }) // 产业布局菜单 $(".three-container").each(function(index,ele){ $(this).find(".third-ul").hide(); $(this).find(".third-ul").eq(0).show(); }); $(".second-ul").each(function(index,ele){ $(this).find("li").eq(0).addClass('on'); }); $(".second-ul li").hover(function(){ $(this).addClass('on').siblings().removeClass('on'); var index5 = $(this).index(); //console.log(index5) $(this).parents('.subnav-ul').find(".three-container .third-ul").eq(index5).show().siblings().hide(); }) $(".third-ul").hover(function(){ var index6 = $(this).index(); $(".second-ul li").eq(index6).addClass('on').siblings().removeClass('on'); }) // 手机端菜单 $(".nav-m-first-i").click(function(){ if($(this).parents('.nav-m-first-li').hasClass('on')){ $(this).parents('.nav-m-first-li').removeClass('on'); $(".nav-m-second-li").removeClass('on'); }else{ $(this).parents('.nav-m-first-li').addClass('on'); } $(this).parents('.nav-m-first-li').siblings().removeClass('on'); }) $(".nav-m-second-li").click(function(){ if($(this).hasClass('on')){ $(this).removeClass('on'); }else{ $(this).addClass('on'); } $(this).siblings().removeClass('on'); }) $(document).on('click', '.jq-open-model, .model-page-dom .model-back', function () { var _fileUrl = $(this).data('file-url') var _modelType = $(this).data('model-type') var html = "
\n" + "
\n" + "
\n" + "
\n" + "
\n" + "
\n"; if(_modelType === 'video') { html += "\n"; } if(_modelType === 'image') { html += "
"; } html += "
"; html += "
"; $("body").append(html); var modelClass = $(".model-page-dom") modelClass.toggleClass('show') if(_modelType === 'video') { var $video = document.getElementById('videoPlay') if (_fileUrl) { $video.pause() $video.load() $video.play() } else { $video.pause() } } if(!_fileUrl) { modelClass.remove() } }) }) function switchList(a, b, child) { if (child === undefined) { child = 1; } $(a + ":nth-child(" + child + ")").addClass("cur"); $(b).removeClass("cur"); $(b + ":nth-child(" + child + ")").addClass("cur"); $(document).on("click", a, function () { var that = $(this); $(a).removeClass("cur"); that.addClass("cur"); var _index = that.index(); $(b).removeClass("cur"); $(b).eq(_index).addClass("cur"); }) } function chktop() { var toph = $(document).scrollTop() if (toph >= 10) { $('#top').addClass('cur') } else { $('#top').removeClass('cur') } } function chkFooterHelp() { var toph = $(document).scrollTop() if (toph >= 100) { $('#footerHelp').addClass('cur') } else { $('#footerHelp').removeClass('cur') } } function IEVersion() { var userAgent = navigator.userAgent //取得浏览器的userAgent字符串 var isIE = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1 //判断是否IE<11浏览器 var isEdge = userAgent.indexOf('Edge') > -1 && !isIE //判断是否IE的Edge浏览器 var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf('rv:11.0') > -1 if (isIE) { var fIEVersion = parseFloat(RegExp['$1']) if (fIEVersion === 7) { return 7 } else if (fIEVersion === 8) { return 8 } else if (fIEVersion === 9) { return 9 } else if (fIEVersion === 10) { return 10 } else { return 6 //IE版本<=7 } } else if (isEdge) { return 'edge' //edge } else if (isIE11) { return 11 //IE11 } else { return 99 //不是ie浏览器 } } function topMao(target) { if (!target) { return } if ($(target).offset()) { $('html, body').animate({scrollTop: $(target).offset().top}, 390) } } function windowScrollChange(boxArr) { var boxArr = [ 'cate001', 'cate002', 'cate003', 'cate004', 'cate005', 'cate006', 'cate007', 'cate008', 'cate009', 'cate0010', 'cate0011', 'cate0012', 'cate0013', 'cate0014', 'cate0015', 'cate0016', 'cate0017', 'cate0018', 'cate0019', 'cate0020', ] const boxDocumentArr = [] for (let i = 0; i <= boxArr.length - 1; i++) { boxDocumentArr[i] = document.getElementById(boxArr[i]) } window.onscroll = () => { scrollChange(boxDocumentArr) const scrollTop = document.documentElement.scrollTop || document.body.scrollTop // console.log(scrollTop) if (scrollTop > 430) { $(".cate-model").addClass('cur') } else { $(".cate-model").removeClass('cur') } } } function scrollChange(boxArr) { const scrollTop = document.documentElement.scrollTop || document.body.scrollTop const winHeight = document.documentElement.clientHeight || document.body.clientHeight for (let i = 0; i <= boxArr.length - 1; i++) { // boxArr[i].offsetTop 标签距离页面顶部的距离 if (boxArr[i]) { const oTop = boxArr[i].offsetTop //console.log(boxArr[i].id, oTop) const bH = boxArr[i].offsetHeight if ((oTop - scrollTop >= 0 && scrollTop + winHeight - oTop > 600) || ((oTop + bH - scrollTop) / winHeight > 0.6 && oTop - scrollTop <= 0)) { const obj = $(`[data-id='${boxArr[i].id}']`) $('.hrefPoint a').removeClass('cur') obj.addClass('cur') } } } }