$(function () { // 动画初始化 if (typeof WOW != 'undefined') { var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 0, mobile: false, live: true }); wow.init(); } //返回顶部 $('.to-top').on('click', function () { $('html,body').stop().animate({ 'scrollTop': 0 }, 500); }); //下滑头部出现背景 $(window).scroll(function () { var h = $(window).height(); var sc = $(window).scrollTop(); var bh = $("body").height(); if (sc > 0) { $(".headfixed").addClass('headerbgm') } else { $(".headfixed").removeClass("headerbgm") }; }); var windowTop1 = 0; $(window).scroll(function () { var header = $(".headfixed"); var scrolls = $(this).scrollTop(); if (scrolls >= windowTop1 && $(document).scrollTop() > 0) { header.addClass('top'); windowTop1 = scrolls; } else { header.removeClass('top'); windowTop1 = scrolls; } }); // 二级导航鼠标悬浮的时候加上背景 $('.menu-list>ul>li').hover(function () { $('.headfixed').addClass('headerbgm'); }) var b; b = $(document).scrollTop(); $(window).scroll(function () { b = $(document).scrollTop(); if (b <= 0) { $('.headfixed').removeClass("headerbgm"); } }) $(".headfixed").hover(function () { $(this).addClass("headerbgm"); }, function () { if (b <= 0) { $(this).removeClass("headerbgm"); } }); // 底部二级导航显示/隐藏 var _winW = $(window).width(); var overscroll = window.innerWidth - document.body.clientWidth; if (_winW + overscroll <= 767) { $('.footer .footerphone-menu h3').on('click', function () { if (!$(this).hasClass("cur")) { $(this).addClass("cur").parent("li").siblings("li").find("h3").removeClass("cur"); $(this).next('.footer-subnav').slideDown().parent("li").siblings("li").find('.footer-subnav').slideUp(); } else { $(this).removeClass("cur"); $(this).next('.footer-subnav').slideUp() } }) } // 选项卡 function tabs(menu, cont, cur) { menu.click(function () { var index = menu.index(this); $(this).addClass(cur).siblings().removeClass(cur); cont.children().eq(index).show().siblings().hide(); }); } /*单个js调用*/ $(document).ready(function () { //tab切换 tabs($('.solution-sec3 .solution-sec3-tab li'), $('.solution-sec3 .solution-sec3-cont'), 'active'); //第一个参数是切换的按钮,第二个参数是切换的内容,第三个参数是鼠标悬浮时的样式 }); /*手机端导航*/ $('.toggle-btn-phone').off('click').on('click', function () { if ($('.mobile-nav-box').is(':hidden')) { $('.mobile-nav-box').stop(true, true).slideDown(500); $(this).addClass('cur'); } else { $('.mobile-nav-box').stop(true, true).slideUp(500); $(this).removeClass('cur'); } }); // 手机端二级导航下拉 $('.menu-list .mobile-nav-box ul li h3 i').on('click', function () { if (!$(this).parent().hasClass("cur")) { $(this).parent().addClass("cur").parent("li").siblings("li").find("h3").removeClass("cur"); $(this).parent().next('.head-subnav').slideDown().parent("li").siblings("li").find('.head-subnav').slideUp(); } else { $(this).parent().removeClass("cur"); $(this).parent().next('.head-subnav').slideUp() } }) $(".head-subnav a").click(function () { $(".mobile-nav-box").stop(true, true).slideUp(500); $(".toggle-btn-phone").removeClass('cur'); }) //加入我们 $(document).on('click', '.insrecruit-list li .rectue-top', function () { var _this = $(this); if (_this.next().is(':hidden')) { _this.parents('li').addClass('cur').siblings().removeClass("cur"); _this.next().stop().slideDown(); _this.parents('li').siblings().find('.rectue-min').stop().slideUp(300); } else { _this.parents('li').removeClass("cur"); _this.next().slideUp(); } }); /*手机端内页顶部导航下拉*/ $('.inner-sec1-snav').click(function () { $(this).find('ul').stop(true, false).slideToggle(); }); // 视频弹窗 $('.videobox').on('click', function () { var u = navigator.userAgent; var url = $(this).attr('videoUrl'); $('.popvideobg').fadeIn(200); if (url.indexOf('http') == 0) { $('#videoPlayer').html('') } else { $('#videoPlayer').html('') if (u.indexOf('iPhone') > -1) { //苹果手机 document.addEventListener("WeixinJSBridgeReady", function () { $('#video')[0].play(); }, false); } else { $('#video')[0].play(); } } }) $('.close-video-btn').on('click', function () { $('.popvideobg').fadeOut(200); $('#videoPlayer').html(''); }) //搜索框 // Handle click on toggle search button $('#toggle-search').click(function () { $('#search-form, #toggle-search').toggleClass('open'); return false; }); // Handle click on search submit button $('#search-form input[type=submit]').click(function () { $('#search-form, #toggle-search').toggleClass('open'); return true; }); // Clicking outside the search form closes it $(document).click(function (event) { var target = $(event.target); if (!target.is('#toggle-search') && !target.closest('#search-form').size()) { $('#search-form, #toggle-search').removeClass('open'); } }); //锚点平滑效果 $("a").click(function () { // console.log($(this).attr("href")); if ($(this).attr("href") != null) { if ($(this).attr("href").indexOf("#") > -1) { var i = $(this).attr("href").substring($(this).attr("href").indexOf("#")); var w = $(window).width(); if (w > 1459) { $("html, body").animate({ scrollTop: $(i).offset().top - 0 + "px" }, 500); } else if (w > 1259) { $("html, body").animate({ scrollTop: $(i).offset().top - 70 + "px" }, 500); } else { $("html, body").animate({ scrollTop: $(i).offset().top - 50 + "px" }, 500); } } } }); /*手机端内页顶部导航下拉*/ $('.smenu-nav').click(function () { $(this).find('ul').stop(true, false).slideToggle(); }); // 产品分类菜单 // 查找每个 b 元素的所有父元素,slideDown()显示,slideUp()隐藏,prev() 检索每个段落,找到类名为 "pn-tit" 的前一个同胞元素: $('.product-sec1-pmenu .product-sec1-dl dd a.active').parents('.product-sec1-mect').slideDown().prev('.product-sec1-pmenu .product-sec1-ltit').addClass('active'); $('.product-sec1-pmenu .product-sec1-ltit').on('click', function () { if (!$(this).hasClass('active')) { $(this).addClass('active').parents('li').siblings('li').find('.product-sec1-ltit').removeClass('active'); $(this).next('.product-sec1-mect').slideDown().parents('li').siblings('li').find('.product-sec1-mect').slideUp() } else { $(this).removeClass('active') $(this).next('.product-sec1-mect').slideUp() } }) //数字滚动 $('.number').countUp(); // kf $(".kf-shqi").click(function () { $('.pc-kf').toggleClass("show"); if ($('.pc-kf').hasClass("show")) { $('.pc-kf').find("span").fadeIn() } else { $('.pc-kf').find("span").fadeOut() } }); $(".pc-kf .back_top").click(function () { $("html,body").animate({ "scrollTop": 0 }, 1000); }); $(".pc-kf span").hover(function () { $(this).find("div").show(); }, function () { $(this).find("div").hide(); }); $(".service-sec2 .service-sec2-font li").hover(function () { var index = $(this).index(); $(".service-sec2 .service-sec2-img .service-sec2-imgif").eq(index).addClass("active").siblings().removeClass("active"); $(".service-sec2 .service-sec2-quan .service-sec2-q").eq(index).addClass("active").siblings().removeClass("active"); // if(index==0){ // $(".service-sec2-quan").css("transform","rotate(0deg)"); // }else if(index==1){ // $(".service-sec2-quan").css("transform","rotate(270deg)"); // }else if(index==2){ // $(".service-sec2-quan").css("transform","rotate(180deg)"); // }else{ // $(".service-sec2-quan").css("transform","rotate(90deg)"); // } }) // 手机端产品目录 var retractLeft = $(".pn-list").width(); $('.product-sec1-smenu').hover(function () { $('.pn-list').addClass('on') $('.pn-retract').css("left", retractLeft) }, function () { $('.pn-list').removeClass('on') $('.pn-retract').css("left", -retractLeft) }) // 收起箭头 $('.pn-retract').hover(function () { $('.pn-list').removeClass('on'); $('.pn-retract').css("left", -retractLeft) }, function () { $('.pn-list').addClass('on') $('.pn-retract').css("left", retractLeft) }) var box = $('.section7 .swiper-slide'); box.mouseenter(function () { $(this).addClass('active').siblings('.swiper-slide').removeClass('active'); }); $(".product-sec3 .swiper-slide").eq(0).addClass('active'); var box = $('.product-sec3 .swiper-slide'); box.mouseenter(function () { $(this).addClass('active').siblings('.swiper-slide').removeClass('active'); }); // FQA // $(".problem-sec1-ul li").eq(0).addClass('active').siblings().removeClass('active'); // $(".problem-sec1-ul li").eq(0).find('.problem-sec1-dec').slideDown(); $(".problem-sec1-ul li").click(function () { $(this).toggleClass('active').siblings().removeClass('active'); $(this).find('.problem-sec1-dec').slideToggle(); $(this).siblings().find('.problem-sec1-dec').slideUp(); }); // swiper // 首页banner var video_length = $(".indexvideo").length; var playList = document.getElementsByTagName('video'); //获取多个video集合 var playList_index = 0; if (video_length > 0) { var videoArray = []; var array = [] $(".banner .swiper-slide").each(function (i, v) { var aa = $(this).find(".indexvideo").parents(".swiper-slide").index(); if (aa != -1) { videoArray.push(aa); array.push({ "key": i, "value": playList[playList_index] }); playList_index++; } }); for (var i = 0; i < playList.length; i++) { //playList[i].play(); playList[i].loop = false; //playback(i); } var swiper1 = new Swiper('.banner-img .swiper-container', { paginationType : 'fraction', paginationFractionRender: function (swiper,currentClassName, totalClassName) { return '0' + '
' + '0'; }, pagination: '.banner-img .swiper-pagination', paginationClickable: true, nextButton: '.banner-img .swiper-button-next', prevButton: '.banner-img .swiper-button-prev', speed: 600, autoplay: 3000, onInit: function (swiper) { var index = swiper.activeIndex; var biaoIndex = $.inArray(index, videoArray); if (biaoIndex >= 0) { array[biaoIndex].value.play() playback(array[biaoIndex].key) swiper.stopAutoplay(); } else { swiper.startAutoplay(); } }, onSlideChangeStart: function (swiper) { var index = swiper.activeIndex; var biaoIndex = $.inArray(index, videoArray); if (biaoIndex >= 0) { array[biaoIndex].value.play() playback(array[biaoIndex].key) swiper.stopAutoplay(); } else { swiper.startAutoplay(); } }, on: { slideChange: function() { var num = this.activeIndex; var a = 100 / ($(".c-banner1 .swiper-slide").length - 2); var b = a * num; var c = num; if (num > $(".c-banner1 .swiper-slide").length - 2) { b = a; c = 1; } if (num < 1) { b = a * ($(".c-banner1 .swiper-slide").length - 2); c = $(".c-banner1 .swiper-slide").length - 2; } $(".c-banner1 .c-dot-box .c-line").css("width", b + "%"); $(".c-banner1 .c-dot-box .c-text1").html("0" + String(c)); }, }, }); function playback(key) { var videoIndex = $.inArray(key, videoArray); if (videoIndex >= 0) { array[videoIndex].value.addEventListener('ended', function () { array[videoIndex].value.pause(); swiper1.startAutoplay(); }, false); } else { swiper1.startAutoplay(); } } } else { var swiper1 = new Swiper('.banner-img .swiper-container', { paginationType : 'fraction', paginationFractionRender: function (swiper,currentClassName, totalClassName) { return '0' + ' / ' + '0'; }, pagination: '.banner-img .swiper-pagination', nextButton: '.banner-img .swiper-button-next', prevButton: '.banner-img .swiper-button-prev', speed: 600, autoplay: 3000, autoplayDisableOnInteraction: false, paginationClickable: true, }) } // 鼠标移入时停止轮播 $('.banner-img .swiper-container').mouseover(function(){ swiper1.stopAutoplay(); }) $('.banner-img .swiper-container').mouseout(function(){ swiper1.startAutoplay(); }) var inswp1 = new Swiper('.section3 .swiper-container', { speed: 800, spaceBetween: 5, autoplay: 3000, paginationClickable: true, effect:'fade', fade:{ crossFade: true, }, simulateTouch: false, nextButton: '.section3 .swiper-button-next', prevButton: '.section3 .swiper-button-prev', pagination: '.section3 .swiper-pagination', }); // 鼠标移入时停止轮播 $('.section3 .swiper-container').mouseover(function(){ inswp1.stopAutoplay(); }) $('.section3 .swiper-container').mouseout(function(){ inswp1.startAutoplay(); }) var inswp2 = new Swiper('.section5 .swiper-container', { speed: 800, spaceBetween: 5, autoplay: 3000, paginationClickable: true, effect: 'fade', fade:{ crossFade: true, }, // simulateTouch: false, nextButton: '.section5 .swiper-button-next', prevButton: '.section5 .swiper-button-prev', pagination: '.section5 .swiper-pagination', }); // 鼠标移入时停止轮播 $('.section5 .swiper-container').mouseover(function(){ inswp2.stopAutoplay(); }) $('.section5 .swiper-container').mouseout(function(){ inswp2.startAutoplay(); }) var proswp1 = new Swiper('.proinfo-sec6 .swiper-container', { slidesPerView: 5, speed: 800, spaceBetween: 25, // autoplay: 3000, paginationClickable: true, simulateTouch: false, nextButton: '.proinfo-sec6 .swiper-button-next', prevButton: '.proinfo-sec6 .swiper-button-prev', pagination: '.proinfo-sec6 .swiper-pagination', breakpoints: { 1259: { spaceBetween: 20, slidesPerView: 4, autoplay: 3000, }, 1100: { spaceBetween: 10, slidesPerView: 4, autoplay: 3000, }, 980: { spaceBetween: 10, slidesPerView: 3, autoplay: 3000, }, 767: { spaceBetween: 15, slidesPerView: 1, autoplay: 3000, }, } }); // 鼠标移入时停止轮播 // $('.proinfo-sec6 .swiper-container').mouseover(function(){ // proswp1.stopAutoplay(); // }) // $('.proinfo-sec6 .swiper-container').mouseout(function(){ // proswp1.startAutoplay(); // }) var proswp2 = new Swiper('.proinfo-sec7 .swiper-container', { slidesPerView: 3, speed: 800, spaceBetween: 30, // autoplay: 3000, paginationClickable: true, nextButton: '.proinfo-sec7 .swiper-button-next', prevButton: '.proinfo-sec7 .swiper-button-prev', pagination: '.proinfo-sec7 .swiper-pagination', breakpoints: { 1100: { spaceBetween: 20, slidesPerView: 2, autoplay: 3000, }, 980: { spaceBetween: 10, slidesPerView: 2, autoplay: 3000, }, 767: { spaceBetween: 10, slidesPerView: 1, autoplay: 3000, }, } }); // 鼠标移入时停止轮播 // $('.proinfo-sec7 .swiper-container').mouseover(function(){ // proswp2.stopAutoplay(); // }) // $('.proinfo-sec7 .swiper-container').mouseout(function(){ // proswp2.startAutoplay(); // }) var soluswp1 = new Swiper('.solution-sec2 .swiper-container', { effect: 'coverflow', grabCursor: true, slidesPerView: 3.3, spaceBetween: 0, speed: 800, autoplay: 3000, loopAdditionalSlides: 5, loop: true, centeredSlides: true, coverflow: { rotate: 0, stretch: 0, depth: 300, modifier: 1, slideShadows: false }, nextButton: '.solution-sec2 .swiper-button-next', prevButton: '.solution-sec2 .swiper-button-prev', pagination: '.solution-sec2 .swiper-pagination', breakpoints: { 1100: { slidesPerView: 2.5, coverflow: { rotate: 0, stretch: 0, depth: 350, modifier: 1, slideShadows: false }, }, 980: { slidesPerView: 2, }, 767: { slidesPerView: 1, coverflow: { rotate: 0, stretch: 0, depth: 0, modifier: 1, slideShadows: false }, spaceBetween: 5, autoplay: 3000, }, } }); // 鼠标移入时停止轮播 $('.solution-sec2 .swiper-container').mouseover(function () { soluswp1.stopAutoplay(); }) $('.solution-sec2 .swiper-container').mouseout(function () { soluswp1.startAutoplay(); }) var soluswp2 = new Swiper('.solution-sec6 .swiper-container', { slidesPerView: 4, spaceBetween: 40, speed: 800, // autoplay: 3000, paginationClickable: true, simulateTouch: false, nextButton: '.solution-sec6 .swiper-button-next', prevButton: '.solution-sec6 .swiper-button-prev', pagination: '.solution-sec6 .swiper-pagination', breakpoints: { 1259: { spaceBetween: 20, slidesPerView: 3, autoplay: 3000, }, 1100: { spaceBetween: 10, slidesPerView: 3, autoplay: 3000, }, 980: { spaceBetween: 10, slidesPerView: 2, autoplay: 3000, }, 767: { spaceBetween: 10, slidesPerView: 1, autoplay: 3000, }, } }); // 鼠标移入时停止轮播 // $('.solution-sec6 .swiper-container').mouseover(function(){ // soluswp2.stopAutoplay(); // }) // $('.solution-sec6 .swiper-container').mouseout(function(){ // soluswp2.startAutoplay(); // }) var soluswp3 = new Swiper('.solution-sec7 .swiper-container', { slidesPerView: 5, spaceBetween: 0, speed: 800, // autoplay: 3000, paginationClickable: true, simulateTouch: false, slidesPerGrou: 3, slidesPerColumn: 3, slidesPerColumnFill: 'row', nextButton: '.solution-sec7 .swiper-button-next', prevButton: '.solution-sec7 .swiper-button-prev', pagination: '.solution-sec7 .swiper-pagination', breakpoints: { 980: { slidesPerView: 4, autoplay: 3000, }, 750: { slidesPerView: 2, autoplay: 3000, } } }); // 鼠标移入时停止轮播 // $('.solution-sec7 .swiper-container').mouseover(function(){ // soluswp3.stopAutoplay(); // }) // $('.solution-sec7 .swiper-container').mouseout(function(){ // soluswp3.startAutoplay(); // }) var abtime = new Swiper('.about-sec3-time .swiper-container', { slidesPerView: 6, spaceBetween: 10, speed: 800, // autoplay: 3000, paginationClickable: true, simulateTouch: false, nextButton: '.about-sec3-time .swiper-button-next', prevButton: '.about-sec3-time .swiper-button-prev', pagination: '.about-sec3-time .swiper-pagination', breakpoints: { 1100: { spaceBetween: 10, slidesPerView: 5, }, 767: { spaceBetween: 10, slidesPerView: 3, }, } }); var abcont = new Swiper('.about-sec3-cont .swiper-container', { slidesPerView: 1, spaceBetween: 10, speed: 800, autoplay: 3000, paginationClickable: true, nextButton: '.about-sec3-cont .swiper-button-next', prevButton: '.about-sec3-cont .swiper-button-prev', pagination: '.about-sec3-cont .swiper-pagination', onSlideChangeStart: function (swiper) { abtime.slideTo(swiper.activeIndex); $('.about-sec3-time .swiper-container .swiper-slide').removeClass('active').eq(swiper.realIndex).addClass('active'); } }); $('.about-sec3-time .swiper-container .swiper-slide').click(function () { if (!$(this).hasClass('active')) { $(this).addClass('active').siblings().removeClass('active'); abcont.slideTo($(this).index(), 1000, false); } }) var abswp1 = new Swiper('.about-sec4 .swiper-container', { spaceBetween: 30, slidesPerView: 5, speed: 800, autoplay: 3000, paginationClickable: true, simulateTouch: false, nextButton: '.about-sec4 .swiper-button-next', prevButton: '.about-sec4 .swiper-button-prev', pagination: '.about-sec4 .swiper-pagination', breakpoints: { 1100: { spaceBetween: 10, slidesPerView: 5, }, 980: { spaceBetween: 10, slidesPerView: 4, }, 767: { spaceBetween: 10, slidesPerView: 2, autoplay: 3000, }, } }); // 鼠标移入时停止轮播 $('.about-sec4 .swiper-container').mouseover(function () { abswp1.stopAutoplay(); }) $('.about-sec4 .swiper-container').mouseout(function () { abswp1.startAutoplay(); }) var abswp2 = new Swiper('.about-sec5 .swiper-container', { spaceBetween: 30, slidesPerView: 2, speed: 800, autoplay: 3000, paginationClickable: true, nextButton: '.about-sec5 .swiper-button-next', prevButton: '.about-sec5 .swiper-button-prev', pagination: '.about-sec5 .swiper-pagination', breakpoints: { 1100: { spaceBetween: 20, slidesPerView: 1, }, 980: { spaceBetween: 15, slidesPerView: 1, }, 767: { spaceBetween: 10, slidesPerView: 1, autoplay: 3000, }, } }); // 鼠标移入时停止轮播 $('.about-sec5 .swiper-container').mouseover(function () { abswp2.stopAutoplay(); }) $('.about-sec5 .swiper-container').mouseout(function () { abswp2.startAutoplay(); }) })