$(function(){ var iBannerHome = new Swiper('.iBannerHome .swiper', { paginationClickable: true, //effect: 'fade', //speed:800, //loop:true, /*autoplay: { delay: 4500, disableOnInteraction: false, },*/ pagination: { el: '.iBannerHome .swiperDots', clickable: true, }, navigation: { nextEl: '.iBannerHome .swiperNext', prevEl: '.iBannerHome .swiperPrev', }, //eventsTarged: iBannerHome,//滑动区域设置 /*mousewheel: { releaseOnEdges: true,//滚到终点后失去滚轮 }*/ }); //首页视频初始播放 var video = $('.videoA_1 video')[0]; var videob = $('.videoA_2 video')[0]; var ua = navigator.userAgent.toLowerCase(); /*在百度中打开*/ /*if (ua.match(/baiduboxapp/i) !== null) { video.removeAttr("autoplay"); }*/ $(video).on('play', function() { //console.log('视频正在播放'); $('.videoBtn_1').addClass('curr'); }); $(video).on('pause', function() { //console.log('视频已经暂停'); $('.videoBtn_1').removeClass('curr'); }); $(videob).on('play', function() { //console.log('视频正在播放'); $('.videoBtn_2').addClass('curr'); }); $(videob).on('pause', function() { //console.log('视频已经暂停'); $('.videoBtn_2').removeClass('curr'); }); //视频播放 $('.videoBtn_1').click(function(){ var _video = $('.videoA_1 video')[0]; if(_video.paused){ $('.videoBtn_1').removeClass('curr'); _video.play(); }else{ $('.videoBtn_1').addClass('curr'); _video.pause(); } }); $('.videoBtn_2').click(function(){ var _video = $('.videoA_2 video')[0]; if(_video.paused){ $('.videoBtn_2').removeClass('curr'); _video.play(); }else{ $('.videoBtn_2').addClass('curr'); _video.pause(); } }); var $menuItems = $('.menu li'), $subMenuItems = $('.menuBoxFr li'), subMenuDelay = 200, showSubMenuTimeout, hideSubMenuTimeout; $('.menu li').mouseenter(function(){ $(this).addClass('active').siblings().removeClass('active'); $('.menuBoxFr li').eq($(this).index()).show().siblings().hide(); }); // 显示和隐藏子菜单容器 $('.menu li, .menuBox').not('.menu li:last-child').mouseenter(function() { if($(window).width() > 1024){ clearTimeout(hideSubMenuTimeout); $('.menuBox').addClass('curr').slideDown(); /*clearTimeout(hideSubMenuTimeout); // 设置延时后显示子菜单 showSubMenuTimeout = setTimeout(function() { $('.menuBox').slideDown(); }, subMenuDelay);*/ } }).mouseleave(function() { if($(window).width() > 1024){ // 清除显示子菜单的延时器 clearTimeout(showSubMenuTimeout); // 设置延时后隐藏子菜单 hideSubMenuTimeout = setTimeout(function() { $('.menuBox').removeClass('curr').slideUp(); }, subMenuDelay); } }); $('.menuBoxFr li a').click(function(){ $('.menuBox').hide(); }) /*$('.menu li').mouseenter(function(){ $(this).addClass('active').siblings().removeClass('active'); $('.menuBoxFr li').eq($(this).index()).show().siblings().hide(); }); $('.menu li,.menuBox').not('.menu li:last-child').mouseenter(function(){ $('.menuBox').show(); }).mouseleave(function(){ $('.menuBox').hide(); });*/ var zmaxWH = "70%"; if($(window).width()<1025){ var zmaxWH = 9999; } $('[rel="example_group1"]').fancybox({ 'transitionIn' : 'elastic', 'transitionOut' : 'elastic', 'speedIn' : 600, 'speedOut' : 200, 'overlayShow' : false, 'maxWidth' : zmaxWH, 'maxHeight' : zmaxWH, }); $('.solutionQA .t').click(function(){ if(!$(this).parents('li').hasClass('curr')){ $(this).parents('li').addClass('curr').siblings().removeClass('curr'); //$(this).parents('li').find('.c').slideDown(); //$(this).parents('li').siblings().find('.c').slideUp(); }else{ $(this).parents('li').removeClass('curr'); //$(this).parents('li').find('.c').slideUp(); } }) $('.osCaseCon .li').each(function(index, value) { var tabIndex = index + 1; var osTabObject = { ['osTab_' + tabIndex]: new Swiper('.osCaseCon .li'+tabIndex+' .osTab .swiper', { //slidesPerView: 6, freeMode: true, watchSlidesProgress: true, breakpoints: { 1681: { slidesPerView: 6, }, 1025: { slidesPerView: 5, }, 641: { slidesPerView: 4, }, 241: { slidesPerView: 3, } } }) }; var osForObject = { ['osFor_' + tabIndex]: new Swiper('.osCaseCon .li'+tabIndex+' .osFor .swiper', { loop: true, thumbs: { swiper: osTabObject['osTab_' + tabIndex], // 确保引用正确初始化的Swiper实例 }, pagination: { el: '.osCaseCon .li'+tabIndex+' .osFor .swiperDots', clickable: true, }, navigation: { nextEl: '.osCaseCon .li'+tabIndex+' .osFor .swiperNext', prevEl: '.osCaseCon .li'+tabIndex+' .osFor .swiperPrev', }, }) }; /*左右切换同步*/ $('.osTab_'+tabIndex+' .swiperNext').click(function(){ $('.osFor_'+tabIndex+' .swiperNext').click(); }); $('.osTab_'+tabIndex+' .swiperPrev').click(function(){ $('.osFor_'+tabIndex+' .swiperPrev').click(); }); }); /*$('.osCaseTab li').click(function(){ $(this).addClass('curr').siblings().removeClass('curr'); $('.osCaseCon .li').eq($(this).index()).addClass('curr').siblings().removeClass('curr'); });*/ $('.osCaseTab li').eq(0).addClass('curr'); $('.osCaseCon .li').eq(0).addClass('curr'); var caseTab = new Swiper('.caseTab .swiper', { slidesPerView: 4, //centeredSlides: true, //slidesPerView : 'auto', freeMode: true, watchSlidesProgress: true, }); var caseFor = new Swiper('.caseFor .swiper', { loop: true, thumbs: { swiper: caseTab, }, pagination: { el: '.caseFor .swiperDots', clickable: true, }, navigation: { nextEl: '.caseFor .swiperNext', prevEl: '.caseFor .swiperPrev', }, }); $('.caseTab .swiperNext').click(function(){ $('.caseFor .swiperNext').click(); }); $('.caseTab .swiperPrev').click(function(){ $('.caseFor .swiperPrev').click(); }); if($('.caseFor .swiperDots span').length <= 1){ $('.caseFor .swiperDots,.caseFor .swiperArrow,.caseTab .swiperDots,.caseTab .swiperArrow').hide(); } $('.aboutNewsListB li').mouseenter(function(){ $(this).addClass('curr').siblings().removeClass('curr'); }); $('.aboutNewsListB_1 li').eq(0).addClass('curr'); $('.aboutNewsListB_2 li').eq(0).addClass('curr'); var aboutNewsListA = new Swiper('.aboutNewsListA .swiper', { paginationClickable: true, //effect: 'fade', speed:800, loop:true, /*autoplay: { delay: 4500, disableOnInteraction: false, },*/ pagination: { el: '.aboutNewsListA .swiperDots', clickable: true, }, navigation: { nextEl: '.aboutNewsListA .swiperNext', prevEl: '.aboutNewsListA .swiperPrev', } }); var aboutHonor = new Swiper('.aboutHonor .swiper', { paginationClickable: true, //effect: 'fade', speed:800, loop:true, /*autoplay: { delay: 3000, disableOnInteraction: false, },*/ pagination: { el: '.aboutHonor .swiperDots', clickable: true, }, navigation: { nextEl: '.aboutHonor .swiperNext', prevEl: '.aboutHonor .swiperPrev', }, breakpoints: { 1025: { slidesPerView: 5, slidesPerGroup:5 }, 769: { slidesPerView:4, slidesPerGroup:4 }, 641: { slidesPerView:4, slidesPerGroup:4 }, 241: { slidesPerView:2, slidesPerGroup:2 } } }); var aboutHistory = new Swiper('.aboutHistory .swiper', { paginationClickable: true, //effect: 'fade', speed:800, loop:true, /*autoplay: { delay: 3000, disableOnInteraction: false, },*/ pagination: { el: '.aboutHistory .swiperDots', clickable: true, }, navigation: { nextEl: '.aboutHistory .swiperNext', prevEl: '.aboutHistory .swiperPrev', }, breakpoints: { 1441: { slidesPerView: 7, slidesPerGroup : 1 }, 1025: { slidesPerView: 6, slidesPerGroup :1 }, 769: { slidesPerView: 5, slidesPerGroup :1 }, 641: { slidesPerView: 4, slidesPerGroup : 1 }, 241: { slidesPerView: 2, slidesPerGroup : 1 } } }); $('.supportNav li').click(function(){ $(this).addClass('curr').siblings().removeClass('curr'); var stop = $('.supportCon dl').eq($(this).index()).offset().top - $('.header').height() - 10; //console.log(stop); $('html,body').animate({scrollTop:stop},500); }); /*$('.supportNav li').eq(0).addClass('curr'); $('.supportCon li').eq(0).addClass('curr');*/ /*$('.solutionNavB li').click(function(){ $(this).addClass('curr').siblings().removeClass('curr'); $('.solutionList ul').eq($(this).index()).addClass('curr').siblings().removeClass('curr'); }); $('.solutionNavB li').eq(0).addClass('curr'); $('.solutionList ul').eq(0).addClass('curr');*/ $('.solutionNavA .h3 span').click(function(){ if(!$(this).parents('li').hasClass('active')){ $(this).parents('li').addClass('active').siblings().removeClass('active'); $(this).parents('li').find('.box').slideDown(); $(this).parents('li').siblings('li').find('.box').slideUp(); }else{ $(this).parents('li').removeClass('active'); $(this).parents('li').find('.box').slideUp(); } }); if($(window).width()>1024){ $('.solutionNavA li.curr .h3 span').click(); }; /*$('.solutionNavA .box a').click(function(){ var dtype = $(this).attr('data-type'); //console.log(dtype); $(this).addClass('curr').siblings().removeClass('curr'); $('.solutionList li').hide(); $('.solutionList li[data-type='+dtype+']').show(); const currentUrl = new URL(window.location.href); currentUrl.searchParams.set('type', dtype); history.pushState(null, null, currentUrl.href); });*/ /*解决方案菜单选中*/ /*const urlParams = new URLSearchParams(window.location.search); const solutiontype = urlParams.get('type'); console.log('Type:', solutiontype); console.log(!!solutiontype) if(!!solutiontype){ $('.solutionList li').hide(); } $('.solutionNavA li a').removeClass('curr'); $('.solutionNavA li a[data-type='+solutiontype+']').addClass('curr'); $('.solutionList li[data-type='+solutiontype+']').show();*/ var iBanner = new Swiper('.iBanner .swiper', { paginationClickable: true, //effect: 'fade', speed:800, loop:true, /*autoplay: { delay: 4500, disableOnInteraction: false, },*/ pagination: { el: '.iBanner .swiperDots', clickable: true, }, navigation: { nextEl: '.iBanner .swiperNext', prevEl: '.iBanner .swiperPrev', } }); $('.iAboutTab li').click(function(){ $(this).addClass('curr').siblings().removeClass('curr'); $('.iAboutCon li').eq($(this).index()).addClass('curr').siblings().removeClass('curr'); $('.iAboutTop .img li').eq($(this).index()).addClass('curr').siblings().removeClass('curr'); }); $('.iAboutTab li').eq(0).addClass('curr'); $('.iAboutCon li').eq(0).addClass('curr'); /*$('.iSolutionTab li').click(function(){ $(this).addClass('curr').siblings().removeClass('curr'); $('.iSolutionCon ul').eq($(this).index()).addClass('curr').siblings().removeClass('curr'); });*/ $('.iSolutionTab li').eq(0).addClass('curr'); $('.iSolutionCon ul').eq(0).addClass('curr'); var iStrength = new Swiper('.iStrength .swiper', { paginationClickable: true, //effect: 'fade', speed:800, //loop:true, /*autoplay: { delay: 3000, disableOnInteraction: false, },*/ pagination: { el: '.iStrength .swiperDots', clickable: true, }, navigation: { nextEl: '.iStrength .swiperNext', prevEl: '.iStrength .swiperPrev', }, breakpoints: { 1025: { slidesPerView:7, //slidesPerView:'auto', slidesPerGroup : 1 }, 961: { slidesPerView: 4, slidesPerGroup :1 }, 641: { slidesPerView: 3, slidesPerGroup :1 }, 241: { slidesPerView: 1, slidesPerGroup : 1 } } }); $('.iStrength .swiper-slide').mouseenter(function(){ $(this).addClass('swiper-slide-active').siblings().removeClass('swiper-slide-active'); /*$(this).animate({width: '25%'}, 300).siblings().animate({width: '12.5%'}, 300);*/ }); $('.iStrength .swiper-slide').eq(0).addClass('swiper-slide-active'); var iNews = new Swiper('.iNews .swiper', { paginationClickable: true, //effect: 'fade', speed:800, loop:true, /*autoplay: { delay: 3000, disableOnInteraction: false, },*/ pagination: { el: '.iNews .swiperDots', clickable: true, }, navigation: { nextEl: '.iNews .swiperNext', prevEl: '.iNews .swiperPrev', }, breakpoints: { 1025: { slidesPerView: 4, slidesPerGroup : 1 }, 961: { slidesPerView: 3, slidesPerGroup :1 }, 641: { slidesPerView: 2, slidesPerGroup :1 }, 241: { slidesPerView: 1, slidesPerGroup : 1 } } }); /*视频*/ $(".play_btn").click(function() { var dataVideo = $(this).attr("data-video"); var poster = $(this).attr("data-img"); $("body").append( '
'); $(".video_bg,.video_box").fadeIn(); }); $(document).on('click','.video_box i',function(){ $(".video_bg,.video_box").fadeOut(500, function() { $(".video_bg,.video_box").remove(); }); }); $(document).on('click','.video_bg',function(){ $(".video_bg,.video_box").fadeOut(500, function() { $(".video_bg,.video_box").remove(); }); }); var proFor = new Swiper('.proFor .swiper', { paginationClickable: true, effect: 'fade', centeredSlides: true, speed:1500, loop:true, loopPreventsSlide: true, /*autoplay: { delay: 3500, disableOnInteraction: false, },*/ pagination: { el: '.proFor .swiperDots', clickable: true, }, navigation: { nextEl: '.proFor .swiperNext', prevEl: '.proFor .swiperPrev', }, on: { slideChange: function () { //console.log('当前页码: ' + this.realIndex); console.log('旧: ' + this.previousIndex,'当前页码: ' + this.activeIndex); if(this.previousIndex > this.activeIndex){ $('.iProCon').addClass('iProCon_fl').removeClass('iProCon_fr'); }else{ $('.iProCon').addClass('iProCon_fr').removeClass('iProCon_fl'); } $('.proTab li').eq(this.realIndex).addClass('curr').siblings().removeClass('curr'); var this_angle = - this.realIndex * 30; $('.proTab ul').css({ transform: 'rotate(' + this_angle + 'deg)' }); if(this.realIndex >= 7){ $('.pNav_iPro li').eq(1).addClass('curr').siblings().removeClass('curr'); }else{ $('.pNav_iPro li').eq(0).addClass('curr').siblings().removeClass('curr'); } } } }); $('.pNav_iPro li').click(function(){ //console.log($(this).index()) if($(this).index() != 1){ $('.proFor .swiperDots span').eq(0).click(); }else{ $('.proFor .swiperDots span').eq(7).click(); } $('.pNav_Text .li').eq($(this).index()).show().siblings().hide(); }) $('.proTab li').click(function(){ $('.proFor .swiperDots span').eq($(this).index()).click(); }) $('.tSearch .i').click(function(){ if(!$(this).parents('.tSearch').hasClass('active')){ $(this).parents('.tSearch').addClass('active'); $(this).parents('.tSearch').find('.box').slideDown(); $('.menu,.tLanguage,.tContact').removeClass('active'); $('.tLanguage .box,.tContact .box').removeAttr('style'); }else{ $(this).parents('.tSearch').removeClass('active'); $(this).parents('.tSearch').find('.box').slideUp(); } }); $('.tContact .i').click(function(){ if(!$(this).parents('.tContact').hasClass('active')){ $(this).parents('.tContact').addClass('active'); $(this).parents('.tContact').find('.box').slideDown(); $('.menu,.tLanguage,.tSearch').removeClass('active'); $('.tLanguage .box,.tSearch .box').removeAttr('style'); }else{ $(this).parents('.tContact').removeClass('active'); $(this).parents('.tContact').find('.box').slideUp(); } }); $('.tLanguage .i').click(function(){ if(!$(this).parents('.tLanguage').hasClass('active')){ $(this).parents('.tLanguage').addClass('active'); $(this).parents('.tLanguage').find('.box').slideDown(); $('.menu,.tContact,.tSearch').removeClass('active'); $('.tContact .box,.tSearch .box').removeAttr('style'); }else{ $(this).parents('.tLanguage').removeClass('active'); $(this).parents('.tLanguage').find('.box').slideUp(); } }); $('.menu-link').click(function(){ if(!$(this).hasClass('active')){ $('.menu-link').addClass('active'); $('.menu').addClass('active'); $('.tContact,.tLanguage,tSearch').removeClass('active'); $('.tContact .box,.tLanguage .box,.tSearch .box').removeAttr('style'); }else{ $('.menu-link').removeClass('active'); $('.menu').removeClass('active'); } }); /*$('.menu li').click(function(){ if($(window).width()<=1024){ $(this).addClass('curr').siblings().removeClass('curr'); $(this).siblings().find('i').removeClass('active'); $(this).siblings().find('.box').slideUp(); } }); $('.menu li .h3 i').click(function(){ if($(window).width()<=1024){ $(this).toggleClass('active'); $(this).parents('.h3').siblings(".box").slideToggle(); } });*/ $('.menu li .h3 span').click(function(){ if($(this).parents('.h3').next('.box').is(':hidden')){ $(this).addClass('active'); $(this).parents('li').addClass('curr').siblings().removeClass('curr').find('.h3 span').removeClass('active'); $(this).parents('.h3').next(".box").slideDown().parents('li').siblings('li').find('.box').slideUp(); }else{ $(this).removeClass('active'); $(this).parents('.h3').siblings(".box").slideUp(); } }); $(".menu dt span").click(function() { if ($(this).parents('dt').next("dd").is(":hidden")) { $(this).addClass("active"); $(this).parents('dl').siblings().find('dd').slideUp(); $(this).parents('dt').next("dd").slideDown(); } else { $(this).removeClass("active"); $(this).parents('dt').next("dd").slideUp(); } }); $('.show_sq').click(function(event){ event.stopPropagation(); $('.nb-icon-wrap').click(); return false; }); $('.back_top,.backTop').click(function(){ $('html,body').animate({scrollTop:0},120); }); $('.pageNext').click(function(){ $('html,body').animate({scrollTop:$(window).height()},500); }); $(window).scroll(function(){ //console.log($(window).scrollTop()) bodyFixb(); $('.menu-link').removeClass('active'); $('.menu').removeClass('active'); }); $(window).resize(function(){ }); $('body').addClass('body_ready'); var inTop = 0; function bodyFixb(){ if($(window).width()>1024){ var setTop = $(window).scrollTop(); if(setTop>50){ $('body').addClass('body_fix'); }else{ $('body').removeClass('body_fix'); } if(setTop>inTop && setTop>200){ $('body').addClass('body_hide'); }else{ $('body').removeClass('body_hide'); } inTop = setTop; } } bodyFixb(); $('.swiperDots').each(function() { //console.log($(this).find('span').length) if($(this).find('span').length<=1){ $(this).hide(); } }); /*页面滑动动画*/ $('.newsInfoCon>*').attr('data-josh-anim-name','fadeIn'); $('.caseInfoCon>*').attr('data-josh-anim-name','fadeIn'); $('.about .text .p>p').attr('data-josh-anim-name','fadeIn'); if($('[data-josh-anim-name]').length>0){ var josh = new Josh({ initClass: "[data-josh-anim-name]", animateInMobile: true, offset: 0.3, //onDOMChange: true }); } // 假设你的元素有特定的类名,例如 ".watched-element" $('[data-number-plus]').each(function() { var $this = $(this); var elementOffsetTop = $this.offset().top; /*$(window).scroll(function() { ifscroll($this,elementOffsetTop) });*/ if($(window).width()<1025){ ifscroll($this,elementOffsetTop) } }); function ifscroll($element,elementOffsetTop){ var $this = $element; var windowHeight = $(window).height(); var windowScrollTop = $(window).scrollTop(); // 计算元素是否在可视区域 var elementVisible = (elementOffsetTop - windowScrollTop) < windowHeight; if (elementVisible && !$this.data('triggered')) { // 添加数据属性避免重复触发 // 元素首次进入可视区域,执行相关操作 executeElementFunction($this); // 设置数据属性表示已触发 $this.data('triggered', true); } } function executeElementFunction($element) { //console.log("元素在可视区域内,执行操作..."); var $this = $element; var next = 0; var intNumberplus = setInterval(function (){ var data = $this.data("number-plus").split(","), start = data[0], end = data[1], s = data[2], avg = (end - start) / (s * 100); next = next + avg; if (next >= end) { next = end; clearInterval(intNumberplus); } $this.html(Math.ceil(next)); }, 20); // 根据$element执行相应的操作,$element是对当前可视元素的引用 // 例如:$element.css('color', 'red'); } });