$(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; // 通栏背景保持不动,子菜单左边缘与当前一级栏目左边缘对齐 function alignSubMenu($menuItem){ if(!$menuItem || !$menuItem.length || $(window).width() <= 1024){ return; } var index = $menuItem.index(), $subMenu = $('.menuBoxFr li').eq(index), $positionBase = $('.header > .wp').first(); if(!$subMenu.length || !$positionBase.length){ return; } var containerLeft = $positionBase.offset().left, containerWidth = $positionBase.innerWidth(), subMenuWidth = $subMenu.outerWidth() || 340, menuLeft = $menuItem.offset().left, targetLeft = menuLeft - containerLeft; targetLeft = Math.max(0, Math.min(targetLeft, containerWidth - subMenuWidth)); $subMenu.css('left', targetLeft + 'px'); } $('.menu li').mouseenter(function(){ $(this).addClass('active').siblings().removeClass('active'); $('.menuBoxFr li').eq($(this).index()).show().siblings().hide(); alignSubMenu($(this)); }); // 显示和隐藏子菜单容器 $('.menu li, .menuBox').not('.menu li:last-child').mouseenter(function() { if($(window).width() > 1024){ clearTimeout(hideSubMenuTimeout); var $menuBox = $('.menuBox'), $activeMenu = $('.menu li.active'); if($menuBox.is(':visible')){ $menuBox.stop(true, true).show().addClass('curr'); if($activeMenu.length){ alignSubMenu($activeMenu); } }else{ $menuBox.stop(true, true).addClass('curr').slideDown(160, function(){ if($activeMenu.length){ alignSubMenu($activeMenu); } }); } /*clearTimeout(hideSubMenuTimeout); // 设置延时后显示子菜单 showSubMenuTimeout = setTimeout(function() { $('.menuBox').slideDown(); }, subMenuDelay);*/ } }).mouseleave(function() { if($(window).width() > 1024){ // 清除显示子菜单的延时器 clearTimeout(showSubMenuTimeout); // 设置延时后隐藏子菜单 hideSubMenuTimeout = setTimeout(function() { $('.menuBox').stop(true, true).removeClass('curr').slideUp(160); }, subMenuDelay); } }); $('.menuBoxFr li a').click(function(){ $('.menuBox').hide(); }) $(window).resize(function(){ var $activeMenu = $('.menu li.active'); if($activeMenu.length){ alignSubMenu($activeMenu); } }); /*$('.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', } }); // 首页产品卡片、简介和右侧缩略图保持同一索引切换。 // 每组组件独立初始化,避免页面内其他同名模块互相影响。 $('.iAboutTop').each(function(){ var $about = $(this); var $tabs = $about.find('.iAboutTab li'); var $contents = $about.find('.iAboutCon li'); var $visuals = $about.find('.aiProductVisual li'); function activateAboutItem(index){ $tabs.eq(index).addClass('curr').siblings().removeClass('curr'); $contents.eq(index).addClass('curr').siblings().removeClass('curr'); $visuals.eq(index).addClass('curr').siblings().removeClass('curr'); } $tabs.on('click', function(event){ event.preventDefault(); activateAboutItem($(this).index()); }); if ($tabs.length) { activateAboutItem(0); } }); // 首页解决方案分类切换。分类与内容通过后台分类 ID 对应, // 不依赖 DOM 顺序,后台新增、删除或调整排序后仍可正常工作。 var $solutionTabs = $('.solutionCategoryTabs li[data-solution-id]'); var $solutionPanels = $('.solutionCardPanels ul[data-solution-panel]'); function activateSolutionTab($tab) { if (!$tab || !$tab.length) { return; } var solutionId = String($tab.attr('data-solution-id')); var solutionUrl = $tab.attr('data-solution-url'); var $panel = $solutionPanels.filter('[data-solution-panel="' + solutionId + '"]'); if (!$panel.length) { return; } $tab.addClass('curr').siblings().removeClass('curr'); $tab.find('a').attr('aria-selected', 'true'); $tab.siblings().find('a').attr('aria-selected', 'false'); $panel.addClass('curr').siblings('ul[data-solution-panel]').removeClass('curr'); if (solutionUrl) { $('.solutionCategoryTabs .solutionAllLink').attr('href', solutionUrl); } } $solutionTabs.find('a[role="tab"]').click(function(event){ event.preventDefault(); activateSolutionTab($(this).parent('li')); }); activateSolutionTab($solutionTabs.filter('.curr').eq(0).length ? $solutionTabs.filter('.curr').eq(0) : $solutionTabs.eq(0)); var $iStrength = $('.iStrength'); var $iStrengthSlides = $iStrength.find('.swiper-slide'); var iStrengthCount = $iStrengthSlides.length; $iStrength .attr('data-tech-count', iStrengthCount) .toggleClass('is-few', iStrengthCount > 0 && iStrengthCount <= 3) .toggleClass('is-overflow', iStrengthCount > 7); var iStrength = new Swiper('.iStrength .swiper', { paginationClickable: true, speed: 650, watchOverflow: true, slidesPerView: 'auto', slidesPerGroup: 1, spaceBetween: 12, pagination: { el: '.iStrength .swiperDots', clickable: true, }, navigation: { nextEl: '.iStrength .swiperNext', prevEl: '.iStrength .swiperPrev', } }); function expandTechnologyCard($slide) { $slide.addClass('is-expanded').siblings().removeClass('is-expanded'); } function collapseTechnologyCards() { $iStrengthSlides.removeClass('is-expanded'); } $iStrengthSlides.on('mouseenter', function(){ expandTechnologyCard($(this)); }); $iStrengthSlides.on('focusin', function(){ expandTechnologyCard($(this)); }); $iStrength.on('mouseleave', function(){ collapseTechnologyCards(); }); $iStrengthSlides.on('focusout', function(event){ if (!$.contains(this, event.relatedTarget)) { $(this).removeClass('is-expanded'); } }); $iStrengthSlides.find('a').on('click', function(event){ if (window.matchMedia('(max-width: 1024px)').matches) { var $slide = $(this).closest('.swiper-slide'); if (!$slide.hasClass('is-expanded')) { event.preventDefault(); expandTechnologyCard($slide); } } }); 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( '