//wow配置 var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset:0, mobile: false, live: true }); function isMobile() { var userAgentInfo = navigator.userAgent; var mobileAgents = [ "Android", "iPhone", "SymbianOS", "Windows Phone", "iPad","iPod"]; var mobile_flag = false; //根据userAgent判断是否是手机 for (var v = 0; v < mobileAgents.length; v++) { if (userAgentInfo.indexOf(mobileAgents[v]) > 0) { mobile_flag = true; break; } } var screen_width = window.screen.width; //根据屏幕分辨率判断是否是手机 if(screen_width <= 992){ mobile_flag = true; } return mobile_flag; } $(function(){ //数字动画 $('.counter').countUp({ delay: 10, time: 2000 }); //头部滚动显示 function scrollt(){ var topp = $(document).scrollTop(); if(topp > 100){ $('.header').find('.logo img').attr('src',_pub+'image/logo01.png'); $('.header').addClass("onshow").find('.phoneIcon>img').attr('src',_pub+'image/phoneicon01.png'); }else{ $('.header').find('.logo img').attr('src',_pub+'image/logo.png'); $(".header").removeClass("onshow").find('.phoneIcon>img').attr('src',_pub+'image/phoneicon.png'); } } if($('.header').is('.onshow') || isMobile()){ var headerHt = $('.header').height(),typeicon = isMobile()?_pub+'image/phoneicon.png':_pub+'image/phoneicon01.png'; $('.header').addClass("onshow").find('.logo img').attr('src',_pub+'image/logo01.png') .parents('.header').find('.phoneIcon>img').attr('src',typeicon); $('.header').is('.onshow')?$('.container').before(`
`):''; }else{ $(window).scroll(function(){ scrollt(); }); } //菜单展开收起 $(document).on('click','#menu_btn',function(){ $('.header').is('.mobile_side')?($('.header').removeClass('mobile_side'),$('.container').removeClass('m_scale')): ($('.container').addClass('m_scale'),$('.header').addClass('mobile_side')); }); //返回顶部 $(window).scroll(function(){ var topp = $(document).scrollTop(); if(topp > $(window).height()-$('.header').height()){ $("#back_top").addClass('onshow'); }else{ $("#back_top").removeClass('onshow'); } }); $(document).on('click','#back_top',function(){ $('html,body').animate({scrollTop: 0},600); }); //homeBanner切换 if($('#homeBanner').length!=0){ $('.homeBanner_bg').attr('data-swiper-parallax-x',$(window).width()); var homeBanner = new Swiper ('#homeBanner', { // lazy:{ // loadPrevNext: true, // }, grabCursor:true, parallax: true, speed:1000, pagination: { el: '.homeBanner_navbtn', clickable :true }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, // autoplay: { // delay: 3000, // disableOnInteraction: false, // }, }); } //honmeBanner播放器 if($('#video_open').length!=0){ $('#video_open').vidbg({'mp4':_pub+'video/zsvideo.mp4',},{ muted: true, loop: true, overlay: false, }); } //wow初始化 if($('.header').is('.onshow')){ if(isMobile()){ setTimeout(function(){ $("#video_open").find('video').oncanplaythrough = $('.czloading').addClass('on'); wow.init(); },2000) }else{ wow.init(); } }else{ setTimeout(function(){ $("#video_open").find('video').oncanplaythrough = $('.czloading').addClass('on'); wow.init(); },2000) } //home材料 if($('.homeStufft_obj').find('.swiper-container').length!=0){ var lg = $('.homeStufft_obj').find('.swiper-container'); $.each(lg, function(index,key) { new Swiper ('#homeStufft'+index, { lazy:true, speed:500, loop: true, slidesPerView:3, followFinger:false, spaceBetween: '1.6%', breakpoints: { 992: { slidesPerView:2, }, 425: { slidesPerView:1, } }, navigation: { nextEl: '#homeStufft_next'+index, prevEl: '#homeStufft_prev'+index, }, on: { slideChangeTransitionStart: function(){ $('#homeStufft_num'+index).text('0'+(this.realIndex+1)); }, }, }); }); $(document).on('click','.homeStufftTab a',function(){ $(this).addClass('on').parent().siblings().children().removeClass('on'); var index = $(this).parent().index(); $('.homeStufft_li').eq(index).addClass('on').siblings().removeClass('on'); }); } //工业降噪 if($('.homeIndustry_type').length!=0){ var firstli = $('.homeIndustry_type').children('li:first-child')[0].getBoundingClientRect().width,lastli = $('.homeIndustry_type').children('li:last-child')[0].getBoundingClientRect().width ,firsticon = $('.homeIndustry_type').children('li:first-child').find('.homeIndustry_icon')[0].getBoundingClientRect().width ,lasticon = $('.homeIndustry_type').children('li:last-child').find('.homeIndustry_icon')[0].getBoundingClientRect().width; $('.homeIndustry_type').css({'margin-left':'-'+(firstli/2-firsticon/2)+'px','margin-right':'-'+(lastli/2-lasticon/2)+'px'}); } //首页交通降噪 if(!isMobile() && $('.homeTraffic_b').length!=0){ $('.homeTraffic_b').height($('.homeTraffic_b').children('li:first-child').innerHeight()+$('.homeTraffic_b').children('li:first-child').find('.homeTraffic_p>div').innerHeight()); $(".homeTraffic_b a").hover(function(){ $(this).find('.homeTraffic_p').height($(this).find('.homeTraffic_p>div').innerHeight()); },function(){ $(this).find('.homeTraffic_p').height(0); }); } //解决方案 if($('.solution_list').length!=0){ var lg = $('.solution_list').find('.swiper-container'); $.each(lg, function(index,key) { new Swiper ('#solution_line'+index, { lazy:true, speed:500, loop: true, slidesPerView:3, slidesPerGroup:3, spaceBetween: '5%', breakpoints: { 992: { slidesPerView:2, slidesPerGroup:2, }, 425: { slidesPerView:1, slidesPerGroup:1, } }, navigation: { nextEl: '#solution_next'+index, prevEl: '#solution_prev'+index, } }); }); $(document).on('click','.solution_tab a',function(){ $(this).addClass('on').parent().siblings().children().removeClass('on'); var index = $(this).parent().index(); $('.solution_line').eq(index).addClass('on').siblings().removeClass('on'); }); } //案例详情 if($('#casedtl_list').length!=0){ var casedtl_list = new Swiper('#casedtl_list', { speed:500, lazy: { loadPrevNext: true, }, watchSlidesProgress: true, slidesPerView: 'auto', centeredSlides: true, loop: true, followFinger:false, grabCursor:true, loopedSlides:3, navigation: { nextEl: '.casedtl_next', prevEl: '.casedtl_prev', }, on: { progress: function(progress) { var wlist = $("#casedtl_list").width(); 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.2 + 1; } translate = slideProgress * modify * (wlist/3.34) + '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,'opacity':1,'-webkit-opacity':1}); if (Math.abs(slideProgress) > 3) { slide.css({'opacity':0,'-webkit-opacity':0}); } } }, setTransition: function(transition) { for (var i = 0; i < this.slides.length; i++) { var slide = this.slides.eq(i) slide.transition(transition); } } } }) } //banner铺满 function resizew(){ var tHt = $('.header').height() + $('.secondNav').height(); $('#h-banner').height($(window).height()-tHt); } if($('#h-banner').length!=0){ if($('#h-banner').children('.pagebanner').attr('ifwd')){ var urls = ''; !isMobile()?urls = $('#h-banner').children('.pagebanner').attr('pcurl'): urls = $('#h-banner').children('.pagebanner').attr('murl'); if($('#h-banner').find('.trafficbaner_txt').length==0){ $('#h-banner').children('.pagebanner').addClass("imgshow").append(''); }else{ $('#h-banner').children('.pagebanner').css('background-image','url('+urls+')'); } } if(!isMobile()){ resizew(); $(window).resize(function(){ resizew(); }); } } //tab切换 $('.wrapper').length!=0?$('.wrapper').navbarscroll():''; //产品图切换 if($('#mpc_img').length!=0){ var mode = 0; var mpc_img = new Swiper('#mpc_img', { lazy:true, speed:500, watchSlidesProgress: true, followFinger:false, grabCursor:true, slidesPerView :2, navigation: { nextEl: '.mpc_next', prevEl: '.mpc_prev', }, on: { slideChangeTransitionStart: function(){ mode = 1; $('#mpc_tab').find('li').eq(this.activeIndex).click(); $('.mpc_line').children('div').eq(this.activeIndex).addClass('on').siblings().removeClass('on'); }, slideChangeTransitionEnd: function(){ mode = 0; }, progress: function() { for (i = 0; i < this.slides.length; i++) { var slide = this.slides.eq(i); var slideProgress = this.slides[i].progress; scale = 1 - Math.abs(slideProgress) / 5; slide.transform('scale(' + scale + ')'); } }, setTransition: function(transition) { for (var i = 0; i < this.slides.length; i++) { var slide = this.slides.eq(i) slide.transition(transition); } } }, }) $(document).on('click','#mpc_tab li',function(){ if(mode == 0){ var index = $(this).index(); mpc_img.slideTo(index, 500, false); $('.mpc_line').children('div').eq(index).addClass('on').siblings().removeClass('on'); } }) } //产品图切换 if($('#acs_tab').length!=0){ $(document).on('click','#acs_tab a',function(){ var is = $(this); is.addClass('on').parent().siblings().children('a').removeClass('on'); $('.acs_fold').find('.acs_fold_item').eq(is.parent().index()).addClass('on').siblings().removeClass('on'); }); } })