//手机端导航 $(function () { //超过一定高度导航添加类名 var nav = $("header"); //得到导航对象 var win = $(window); //得到窗口对象 var sc = $(document); //得到document文档对象。 win.scroll(function () { if (sc.scrollTop() >= 100) { nav.addClass("on"); } else { nav.removeClass("on"); } }) //移动端展开nav $('.p_iconBox').on('click', function () { $('.m_nav').addClass('open'); }) //关闭nav $('.m_nav .top .closed').on('click', function () { $('.m_nav').removeClass('open'); }) //二级导航 移动端 $(".m_nav .ul li").click(function () { $(this).children("div.dropdown_menu").slideToggle('slow').end().find('.jt').toggleClass( 'jtRote'); $(this).siblings('li').children('.dropdown_menu').slideUp('slow').end().find('.jt') .removeClass('jtRote'); }); }) // 首页产品弹出 $(function() { $('.imgSrcBox .prod_img').on('mouseover', function() { $(this).parent('.imgSrcBox').find('.prod-big-pic').show() }); $('.imgSrcBox .prod_img').on('mouseout', function() { $(this).parent('.imgSrcBox').find('.prod-big-pic').hide() }); $('.imgSrcBox .prod_img').on('click', function() { let p_link = $('this').html() //.attr('href-data') console.log(p_link); return; window.location.href = p_link; }) //多页隐藏 var num = $(".p_page").find("a.page_num").length; if (num == 1) { $(".p_page").addClass("hide"); } }) //二级分类高亮 var href = location.pathname + location.search; // let href = $('.p_breadcrumbList .contentBox:last a').attr('href') //if (!href) return; $(".e_container-1 .p_list .p_loopitem").each(function(i, e) { var aa = $(e).find('a').attr("href"); if (aa == href) { // 自身样式 $(e).addClass('light') .end().siblings('.p_loopitem').removeClass('light'); } }); //内页分类效果 // 获取 屏幕宽度 var domWith = $(document).width(); // console.log(domWith); var href = location.pathname + location.search; // let href = $('.p_breadcrumbList .contentBox:last a').attr('href') //if (!href) return; $(".content .p_linkBox .yjLink").each(function(i, e) { var aa = $(e).attr("href"); if (aa == href) { // 自身样式 $(e).parents('li.p_linkBox').addClass('light') .end().siblings('li').removeClass('light'); } }); $('.yjTitle').find('a').each(function (index, ele) {//二级当前导航展开 var href_yi = $(ele).attr('href'); console.log(href_yi); if (href_yi == href) { $(ele).parents('.yjLi').addClass('active').siblings('.yjLi').removeClass('active')//一级导航加高亮 } }) $('.ejTitle').find('a').each(function (index, ele) {//二级当前导航展开 var hrefa = $(ele).attr('href'); if (hrefa == href) { $(ele).parents('li').addClass('active').siblings('li').removeClass('active')//一级导航加高亮 $(ele).parents('li').children('h3').children('.iconfont ').addClass('rotate')// .end().end().children('ul').slideDown().end().siblings('li') .find('.iconfont').removeClass('rotate').end().find('.ul').slideUp(); } }) $('.sjTitle').find('a').each(function (index, ele) {//二级当前导航展开 var hrefa = $(ele).attr('href'); if (hrefa == href) { $(ele).parents('li').addClass('active').siblings('li').removeClass('active')//一级导航加高亮 $(ele).parents('li').children('h3').children('.iconfont ').addClass('rotate')// .end().end().children('ul').slideDown().end().siblings('li') .find('.iconfont').removeClass('rotate').end().find('.ul').slideUp(); } }) if (domWith > 768) { //首页应用滑动 $('#c_static_001-1661740444647 .p_list .p_loopitem:eq(0)').addClass('active') $('#c_static_001-1661740444647 .p_list .p_loopitem').on('mouseover',function(){ $(this).addClass('active').siblings().removeClass('active') }) // 三级显示 $('.ejLi').hover(function() { // 图标 转向 $(this).find('.iconfont2').addClass('icf').end() .find('.sjBox').show(); }, function() { // 图标复原 $(this).find('.iconfont2').removeClass('icf').end() .find('.sjBox').hide(); }) } else { // 移动端 点击出现 $('.moveBtn').on('click', function() { // 按钮隐藏 $(this).css({ 'opacity': 0 }, 500) // 内容滑出 $('.contentBox').animate({ "left": 0 }, 500) }) // 移动端 点击收回 $('.backBtn').on('click', function() { // 按钮显示 $('.moveBtn').css({ 'opacity': 1 }, 500) // 内容收回 $('.contentBox').animate({ "left": "100%" }, 500) }) // 移动端二级 点击事件 $('.iconfont2').on('click', function() { // 蓝线的显示与隐藏 $(this).siblings('.line_right').toggleClass('line_show'); // 自身 三级下拉 ,其它的隐藏 $(this).toggleClass('jsDeg') .parents('.ejLi').find('.sjBox').slideToggle().end() .siblings('.ejLi').find('.sjBox').slideUp() .end().find('.iconfont2').removeClass('jsDeg'); }) } //滚动代码 var ms = $("#certify"); if (ms.length > 0) { certifySwiper = new Swiper('#certify .swiper-container', { watchSlidesProgress: true, slidesPerView: 'auto', centeredSlides: true, loop: true, loopedSlides: 3, autoplay: true, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, pagination: { el: '.swiper-pagination', //clickable :true, }, on: { progress: function(progress) { for (i = 0; i < this.slides.length; i++) { var slide = this.slides.eq(i); var slideProgress = this.slides[i].progress; modify = 1; if (Math.abs(slideProgress) > 1) { modify = (Math.abs(slideProgress) - 1) * 0.3 + 1; } translate = slideProgress * modify * 260 + 'px'; scale = 1 - Math.abs(slideProgress) / 3; zIndex = 999 - Math.abs(Math.round(10 * slideProgress)); slide.transform('translateX(' + translate + ') scale(' + scale + ')'); slide.css('zIndex', zIndex); slide.css('opacity', 1); if (Math.abs(slideProgress) > 3) { slide.css('opacity', 0); } } }, setTransition: function(transition) { for (var i = 0; i < this.slides.length; i++) { var slide = this.slides.eq(i) slide.transition(transition); } } } }) } $(function() { if (isFrontEnv()) { //加英文图片提示 let t = $('title').text() $('body').find('img').each(function(){ let picText = $("img").attr('alt'); if(picText = '图片名称'){ $("img").attr('alt',t); $("img").attr('title',t); } }); //面包屑补丁 $('.p_breadcrumb .p_breadcrumbItem').each(() => { let a = $(this).find('a').attr('href'); if (a == 'undefined') { $(this).hide() } }) //文字打散 $("#c_static_001-16575286501900 .e_text-2 , #c_static_001-1645253205640 .e_text-2").each(function() { $(this).html("" + $(this).text().trim().split("").join("") + ""); $(this).find("span").each(function() { if (Math.random() > 0.5) { $(this).css("transition-delay", Math.random() + "s"); } }); }); } });