/** * JS鍩虹澶勭悊妗嗘灦 * * @company: iqweb * @author: jack * @timer: 2019-05-016 */ var IqwXiongJs = { Width: $(window).width(), Height: $(window).height(), //banner鍒囨崲鏁堟灉 SwiperFadeIn: 'fade', EventKey: 'click', indexBanner: null, scrollTop: null, WowJsAnimation: null, HeaderTrue: false, //banner鑷姩鍒囨崲 SwiperAuto: true, imgLoad: [], AllImgLoad: [], AllImgFalse: [], //鍔ㄧ敾鏃堕棿鍜屽垏鎹㈡椂闂 AnimateTime: 500, SwitchTime: 3000, //banner寰幆鎾斁 SwiperLoop: 'loop', //绉诲姩1.5,鐢佃剳3 SwiperN: 3, //瀵艰埅鍒ゆ柇 IfNav: false, //澶撮儴楂樺害 headerH: 110, //banner鏂囧瓧鏁堟灉 bannerAnimation: 'fadeInLeft2', //鏁板瓧婊氬姩鍒ゆ柇 NumberIf: true, //閿氱偣璺濈 maoNumber: 0, //鏈夐敋鐐规墠鍚搁《 maoTop: false, //swiper灞呬腑 centerSwiper: false, //鑷敱鍔犲叆 NewsTab: null, ServiceSwiper: null, advantageG: null, fzAbout: null, honorAbout: null, swiperNumber: 4, navSetH :0, //EventKey: "ontouchstart" in document.documentElement ? "touchstart" : "click", Init: function () { var that = this; that.AddEventList(); }, //banner BannerSwiper: function () { this.indexBanner = new Swiper('.banner-box', { effect: this.SwiperFadeIn, loop: this.SwiperLoop, autoplay:true, fadeEffect: { crossFade: true, }, pagination: { el: '.banner-box .swiper-pagination', clickable: true, }, loopedSlides: document.querySelectorAll('.swiper-slide').length, on: { init: function () { $('.swiper-text-box .swiper-animation').removeClass('fadeInLeft2'); $('.swiper-text-box1 .swiper-animation').addClass('fadeInLeft2'); }, slideChangeTransitionEnd: function () { if (this.activeIndex == (this.loopedSlides - 1)) { $('.swiper-slide .swiper-text-box .swiper-animation').removeClass('fadeInLeft2'); $('.swiper-text-box' + this.loopedSlides + ' .swiper-animation').addClass('fadeInLeft2'); } if (this.activeIndex == (this.loopedSlides * 2)) { $('.swiper-slide .swiper-text-box .swiper-animation').removeClass('fadeInLeft2'); $('.swiper-text-box1 .swiper-animation').addClass('fadeInLeft2'); } for (var i = 0; i < this.loopedSlides; i++) { if ((this.activeIndex - this.loopedSlides) == i) { $('.swiper-slide .swiper-text-box .swiper-animation').removeClass('fadeInLeft2'); $('.swiper-text-box' + (i + 1) + ' .swiper-animation').addClass('fadeInLeft2'); break; } } }, }, }); }, //鑾峰彇TOP NavScroll: function () { var that = this; that.scrollTop = $(window).scrollTop(); that.NavScrollTop(); $(window).scroll(function () { that.NavScrollTop(); }); }, //鍒ゆ柇top鍊 NavScrollTop: function () { var that = this; that.scrollTop = $(window).scrollTop(); //澶т簬瀵艰埅鐨勯珮搴 if (that.scrollTop > 85) { $('.header-wrap').addClass('header-wrap2'); if (that.Width > 1200) { $('.advantage-wrap').addClass('advantage-wrap2'); $('.banner-box .swiper-pagination-bullets').addClass('advantage-wrap2'); } } else { $('.header-wrap').removeClass('header-wrap2'); if (that.Width > 1200) { $('.advantage-wrap').removeClass('advantage-wrap2'); $('.banner-box .swiper-pagination-bullets').removeClass('advantage-wrap2'); } } if (that.Width > 1200) { if (that.scrollTop > $('.read-banner-wrap').height()) { $('.read-nav').addClass('read-position'); } else { $('.read-nav').removeClass('read-position'); } } else { $('.search-input input').blur() } //鍥炲埌椤堕儴鎸夐挳鍑虹幇 if (that.Width > 1200) { if (that.scrollTop > (that.Height / 2)) { $('.return-top').fadeIn() } else { $('.return-top').fadeOut() } } // //瀹氫綇瀵艰埅 // if (that.Width > 1200) { // var navSetOf = $('.read-banner-img img').height() - 35; // if (that.scrollTop > navSetOf) { // $('.product-read-animation').addClass('product-read-fixed width-auto'); // } else { // $('.product-read-animation').removeClass('product-read-fixed width-auto'); // } // } // // //瀹氫綇瀵艰埅 // if (that.Width > 1200) { // // var navSetOf2 = ($('.read-banner-img img').height() + $('.faq-read-box').height() + 50)- that.navSetH; // console.log(that.navSetH); // console.log(that.scrollTop); // console.log(navSetOf2); // if (that.scrollTop > navSetOf2) { // $('.product-read-animation').fadeOut(); // } else { // $('.product-read-animation').fadeIn(); // } // } }, //鑾峰彇搴曢儴top鍊 footerTop: function () { //绐楀彛婊氬姩 var FooterLogo = $('.footer-logo-wrap').offset().top; var windowH = $(window).height(); var FooterTop = FooterLogo - windowH; var scrollTop = $(window).scrollTop(); if (scrollTop >= FooterTop) { $('.footer-logo-wrap').removeClass('footer-animation').addClass('footer-animation'); } $(window).scroll(function () { var FooterLogo = $('.footer-logo-wrap').offset().top; var windowH = $(window).height(); var FooterTop = FooterLogo - windowH; var scrollTop = $(window).scrollTop(); if (scrollTop >= FooterTop) { $('.footer-logo-wrap').removeClass('footer-animation').addClass('footer-animation'); } }); }, //绉诲姩绔粦鍔 or PC绔笎鐜 ifWidth: function () { var that = this; if (that.Width < 1200) { that.SwiperFadeIn = ''; that.headerH = 65; that.SwiperN = 1; that.swiperNumber = 1.5; that.centerSwiper = true; that.maoNumber = -60; $('.swiper-fz-text .swiper-fz-span:nth-child(1) span').addClass('wow fadeInLeft d2'); $('.swiper-fz-text .swiper-fz-span:nth-child(2)').addClass('wow fadeInRight d2'); $('.advantage-li').addClass('wow fadeInUp'); } else { $('.swiper-fz-wrap').addClass('wow fadeInUp d4'); } // that.footerTop(); }, //鍔ㄧ敾鍚姩 WowJs: function () { this.WowJsAnimation = new WOW({ animateClass: 'animated', offset: 50 }); this.WowJsAnimation.init(); }, //浜嬩欢 AddEventList: function () { var that = this; function return_false() { return false; } // $('html,body,.black-box').on('mousewheel DOMMouseScroll wheel', return_false); for (var i = 0; i < $('.data1').length; i++) { that.imgLoad.push( $('.data1').eq(i).attr('data-src') ) } for (var j = 0; j < $('.data2').length; j++) { that.AllImgLoad.push( $('.data2').eq(j).attr('data-src') ) } for (var l = 0; l < $('.data3').length; l++) { that.AllImgFalse.push( $('.data3').eq(l).attr('data-src') ) } if (that.imgLoad.length > 0) { that.indexImgLoad(); } //瀵艰埅閬僵鍑虹幇 $('.m-header-nav').on('click', function (e) { e.preventDefault(); if (!that.IfNav) { $('html,body, .black-box').on('mousewheel DOMMouseScroll wheel', return_false); $('.m-header-nav span:first-child').removeClass('first-rotate2').addClass('first-rotate'); $('.m-header-nav span:last-child').removeClass('last-rotate2').addClass('last-rotate'); $('.m-header-nav span:nth-child(2)').removeClass('navOpacity2').addClass('navOpacity'); $('.m-header-nav').addClass('header-click-nav'); for (var i = 0; i < $('.header-m-a').length; i++) { $('.header-m-a').eq(i).addClass('fadeInUp2'); $('.header-m-a').eq(i).css({ animationDelay: (i * 200) + 'ms', webkitAnimationDelay: (i * 200) + 'ms' }); } $('.header-language').removeClass('fadeInUp2 d7').addClass('fadeInUp2 d7'); $('.header-wrap').removeClass('header-position').addClass('header-position'); $('.header-nav').removeClass('header-nav-show').addClass('header-nav-show'); $('.black-box').stop(); $('.black-box').fadeIn(); $('.header-wrap').addClass('header-height'); that.IfNav = true; } else { $('html,body, .black-box').off('mousewheel DOMMouseScroll wheel', return_false); $('.m-header-nav span:first-child').removeClass('first-rotate').addClass('first-rotate2'); $('.m-header-nav span:last-child').removeClass('last-rotate').addClass('last-rotate2'); $('.m-header-nav span:nth-child(2)').removeClass('navOpacity').addClass('navOpacity2'); $('.m-header-nav').removeClass('header-click-nav'); $('.header-language').addClass('fadeInUp2 d7').removeClass('fadeInUp2 d7'); for (var j = 0; j < $('.header-m-a').length; j++) { $('.header-m-a').eq(i).removeClass('fadeInUp2'); } $('.header-wrap').addClass('header-position').removeClass('header-position'); $('.header-nav').addClass('header-nav-show').removeClass('header-nav-show'); $('.black-box').stop(); $('.black-box').fadeOut(); $('.header-wrap').removeClass('header-height'); that.IfNav = false; } }); //鎼滅储妗 $('.search-button').on('click', function (e) { e.preventDefault(); $('.nav-list .header-li .header-a').addClass('header-a-scale'); $('.nav-list').addClass('header-zindex'); $('.header-en').addClass('header-a-scale header-zindex'); $('.header-search').addClass('header-a-scale'); $('.header-wrap').addClass('header-back'); $('.header-search2').addClass('header-a-scale2'); $('.search-input').addClass('input-left'); $('.header-search-button').addClass('input-left'); $('.search-input input').focus(); }); //鍏抽棴鎼滅储妗 $('.search-hide').on('click', function (e) { e.preventDefault(); $('.nav-list .header-li .header-a').removeClass('header-a-scale'); $('.nav-list').removeClass('header-zindex'); $('.header-en').removeClass('header-a-scale header-zindex'); $('.header-search').removeClass('header-a-scale'); $('.header-wrap').removeClass('header-back'); $('.header-search2').removeClass('header-a-scale2'); $('.search-input').removeClass('input-left'); $('.header-search-button').removeClass('input-left'); $('.search-input input').val(''); $('.search-input input').blur(); }); //鍥炲埌椤堕儴 $('#top').on('click', function () { that.TopHtml(); }); //鎮诞绐楀彛 var FloatNav = $(".float-nav"); FloatNav.hover(function () { $('.float-nav').addClass('float-max'); }, function () { $('.float-nav').removeClass('float-max'); }); //浜岀淮鐮 /*$('.footer-ewm-show').hover(function () { $('.footer-contact-ewm').addClass('fadeInUp3'); }, function () { $('.footer-contact-ewm').removeClass('fadeInUp3'); });*/ //鐐瑰嚮涓嬫媺 if (that.Width < 1200) { var IfPro = false; $('.pro-down').on('click', function (e) { e.preventDefault(); if (!IfPro) { $('.pro-list-wrap').stop(true, true).slideDown(600); $('.pro-current-icon').addClass('rotate-icon'); IfPro = true; } else { $('.pro-list-wrap').stop(true, true).slideUp(600); $('.pro-current-icon').removeClass('rotate-icon'); IfPro = false; } }); } //鑱旂郴鎴戜滑涓嬫媺 $('.join-top').on('click', function (e) { e.preventDefault(); var joinThis = $(this); if (joinThis.hasClass('join-blue')) { $(this).removeClass('join-blue'); $(this).siblings('.join-bottom').stop(true, true).slideUp(600); $(this).find('.join-read:nth-child(4) span').html('+'); } else { $(this).addClass('join-blue'); $(this).siblings('.join-bottom').stop(true, true).slideDown(600); $(this).find('.join-read:nth-child(4) span').html('-'); } }); }, //鏍囩閫夋嫨 lableList: function () { var lableClick = $('.mbx-nav span'); lableClick.on('click', function () { var lableThis = $(this); var lableIndex = lableThis.index(); console.log(lableIndex); if (lableThis.hasClass('max-hover')) { lableClick.eq(lableIndex).removeClass('max-hover'); } else { lableClick.eq(lableIndex).addClass('max-hover'); } }); }, //鍥炬枃涓嬫媺 imgDown: function () { var that = this; var imgName = $('.banner-img-down'); var arr = [ 'easeInQuad', 'easeOutQuad', 'easeInOutQuad', 'easeInCubic', 'easeOutCubic', 'easeInOutCubic', 'easeInQuart', 'easeOutQuart', 'easeInOutQuart', 'easeInQuint', 'easeOutQuint', 'easeInOutQuint', 'easeInSine', 'easeOutSine', 'easeInOutSine', 'easeInExpo', 'easeOutExpo', 'easeInOutExpo', 'easeInCirc', 'easeOutCirc', 'easeInOutCirc', 'easeInElastic', 'easeOutElastic', 'easeInOutElastic', 'easeInBack', 'easeOutBack', 'easeInOutBack', 'easeInBounce', 'easeOutBounce', 'easeInOutBounce' ]; var Down = $(window).scrollTop(); var Blur = $(window).scrollTop() - imgName.height(); var Blur2 = imgName.height() + (Blur); var BlurPX = imgName.height() - Blur2; var scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; var t; if (Down <= 0) { t = setTimeout(function () { $(document.body).animate({ 'scrollTop': imgName.height() - that.headerH }, {duration: 1500, easing: arr[18]}); $('html').animate({ 'scrollTop': imgName.height() - that.headerH }, {duration: 1500, easing: arr[18]}); }, 2000); } if (BlurPX > 100) { imgName.css({ filter: 'blur(' + (Blur2 * 0.021) + 'px)' }) } $(window).scroll(function () { clearTimeout(t); Blur = $(window).scrollTop() - imgName.height(); Blur2 = imgName.height() + (Blur); BlurPX = imgName.height() - Blur2; if (BlurPX > 100) { imgName.css({ filter: 'blur(' + (Blur2 * 0.021) + 'px)' }) } }); }, //瀵艰埅涓嬫媺 navDown: function () { var that = this; $('.nav-show').hover(function () { $('.header-down').stop(true, true).slideDown(); $('.nav-show').addClass('header-down-hover'); }, function () { $('.header-down').stop(true, true).slideUp(); $('.nav-show').removeClass('header-down-hover'); }); }, //鍦板浘 IsMap: function () { var that = this; var map_ico = $('#allmap').attr('data-icon'); if (that.Width < 1200) { var map = new BMap.Map("allmap"); // 鐧惧害鍦板浘API鍔熻兘 var point = new BMap.Point(116.919008, 36.810857); map.centerAndZoom(point, 19); //鍒涘缓瑕嗙洊鐐 var pt = new BMap.Point(116.919821, 36.810572); var myIcon = new BMap.Icon(map_ico, new BMap.Size(130, 48)); var marker2 = new BMap.Marker(pt, {icon: myIcon}); // 鍒涘缓鏍囨敞 map.addOverlay(marker2); // 灏嗘爣娉ㄦ坊鍔犲埌鍦板浘涓 } else { var map = new BMap.Map("allmap"); // 鐧惧害鍦板浘API鍔熻兘 var point = new BMap.Point(116.91824, 36.811204); map.centerAndZoom(point, 19); //鍒涘缓瑕嗙洊鐐 var pt = new BMap.Point(116.919821, 36.810572); var myIcon = new BMap.Icon(map_ico, new BMap.Size(130, 48)); var marker2 = new BMap.Marker(pt, {icon: myIcon}); // 鍒涘缓鏍囨敞 map.addOverlay(marker2); // 灏嗘爣娉ㄦ坊鍔犲埌鍦板浘涓 } }, //閫夐」鍗 tabList: function () { $('.service-index-button li').hover(function () { $(".service-index-button li").eq($(this).index()).addClass("service-active").siblings().removeClass('service-active'); $(".service-index-button li").eq($(this).parents('.service-index-height').find('.service-animation').addClass('fadeInLeft2')).siblings().removeClass('fadeInLeft2'); $(".service-position").hide().eq($(this).index()).show(); }) }, //鏁板瓧婊氬姩 numberRoll: function () { var that = this; //绐楀彛婊氬姩 var dataTop = $('.data-number').offset().top; var dataH = dataTop - that.Height; var scrollTop = $(window).scrollTop(); if (scrollTop > dataH && scrollTop < dataTop) { that.NumberCount(); } $(window).scroll(function () { var dataTop = $('.data-number').offset().top; var dataH = dataTop - that.Height; var scrollTop = $(window).scrollTop(); if (scrollTop > dataH && scrollTop < dataTop) { that.NumberCount(); } }); }, NumberCount: function () { var that = this; if (that.NumberIf) { $("#number1").numberRock({ lastNumber: $("#number1").data('num'), duration: 2000, easing: 'swing', }); $("#number2").numberRock({ lastNumber: $("#number2").data('num'), duration: 2000, easing: 'swing', }); $("#number3").numberRock({ lastNumber: $("#number3").data('num'), duration: 2000, easing: 'swing', }); that.NumberIf = false; } }, //鏂伴椈 newsTab: function () { var that = this; that.NewsTab = new Swiper('.news-swiper', { slidesPerView: 1.5, initialSlide: 0, centeredSlides: true,//灞呬腑 loop: true, spaceBetween: 10, pagination: { el: '.news-pagination', clickable: true, }, // navigation: { // nextEl: '.news-swiper-next', // prevEl: '.news-swiper-prev', // }, }); }, //鍙戝睍鍘嗙▼ FzSwiper: function () { var that = this; that.fzAbout = new Swiper('.fz-about-swiper', { slidesPerView: 3, spaceBetween: 0, navigation: { nextEl: '.fz-swiper-next', prevEl: '.fz-swiper-prev', } }); }, //鑽h獕璧勮川 honorSwiper: function () { var that = this; that.honorAbout = new Swiper('.honor-about-swiper', { slidesPerView: that.swiperNumber, centeredSlides: that.centerSwiper, loop: true, spaceBetween: 0, navigation: { nextEl: '.honor-swiper-next', prevEl: '.honor-swiper-prev', } }); }, //搴曢儴甯冨眬 footerNav: function () { var FooterNav = $('.footer-nav').width(); var NavWidth = $('.footer-nav .footer-ul').width(); var NavLi = (FooterNav - NavWidth) / 4; $('.footer-nav .footer-ul .footer-li').css({ paddingRight: parseInt(NavLi) - .1 }); $('.footer-nav .footer-ul .footer-li:last-child').css({ paddingRight: 0 }); }, //鍥炲埌椤堕儴 TopHtml: function () { var scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; $(document.body).animate({ scrollTop: 0 }, 700); $('html').animate({ scrollTop: 0 }, 700) }, //閿氱偣鐗规晥 maoAnimate: function () { var that = this; that.maoTop = true; that.aboutNav(); var _hash = window.location.hash; //閿氱偣婊戝姩 $('.about-mao').click(function () { var $target = $(this.hash); if ($target && $target.get(0)) { var targetOffset = $target.offset().top; $('html,body').animate({ scrollTop: targetOffset + that.maoNumber }, 700); return false; } }); setTimeout(function () { if (_hash && $(_hash).get(0)) { $('html,body').animate({ scrollTop: $(_hash).offset().top + that.maoNumber }, 700); } }, 500); }, //鍐呭鑸惛椤 aboutNav: function () { var that = this; var top = $(window).scrollTop(); var aCurrent = $('.read-about'); for (var i = 0; i < aCurrent.length - 1; i++) { if ((top + 1) >= aCurrent.eq(i).offset().top && top < aCurrent.eq(i + 1).offset().top) { $('.read-nav ul li').eq(i).addClass('read-hover').siblings().removeClass('read-hover'); } } if (top > aCurrent.eq(aCurrent.length - 1).offset().top) { $('.read-nav ul li').eq(aCurrent.length - 1).addClass('read-hover').siblings().removeClass('read-hover'); } $(window).scroll(function () { var top = $(window).scrollTop() + 1; var aCurrent = $('.read-about'); for (var i = 0; i < aCurrent.length - 1; i++) { if ((top + 1) >= aCurrent.eq(i).offset().top && top < aCurrent.eq(i + 1).offset().top) { $('.read-nav ul li').eq(i).addClass('read-hover').siblings().removeClass('read-hover'); } } if (top > aCurrent.eq(aCurrent.length - 1).offset().top) { $('.read-nav ul li').eq(aCurrent.length - 1).addClass('read-hover').siblings().removeClass('read-hover'); } }) }, //榛樿鏂规硶 HtmlInit: function () { var that = this; $('html, body').show(); that.imgDown(); that.ifWidth(); that.WowJs(); that.footerNav(); //鍔犺浇鑽h獕swiper that.honorSwiper(); that.navSetH=$('.product-read-animation').height(); //PC绔鑸笅鎷 if (that.Width > 1200) { that.navDown(); that.FzSwiper(); } that.NavScroll(); $('.video').trigger('play'); }, //棰勫姞杞界涓€灞忕殑鍥剧墖 indexImgLoad: function () { var that = this; var len = that.imgLoad.length; //鍥剧墖棰勫姞杞 $.preload(that.imgLoad, { // 鏄惁鏈夊簭鍔犺浇 order: true, minTimer: 500, //姣忓姞杞藉畬涓€寮犳墽琛岀殑鏂规硶 each: function (count) { var percent = Math.round((count + 1) / len * 100) + '%'; $('.data1').eq(count).append(''); }, // 鍔犺浇瀹屾墍鏈夌殑鍥剧墖鎵ц鐨勬柟娉 end: function () { console.log('鍔犺浇棣栧睆'); that.HtmlInit(); //棣栧睆鍥剧墖澶鎸夐『搴忓姞杞斤紝灏戜簬1寮犱笉鍔犺浇 if (that.AllImgLoad.length > 0) { //鍔犺浇棣栧睆鍓╀笅鐨刡anner that.indexImages(); } if (that.AllImgLoad.length == 0) { that.allImages(); that.BannerSwiper(); } // //淇敼鏍囬 // document.title = (index + 1) + '/' + len; } }); }, //鍔犺浇棣栧睆鍓╀笅鐨刡anner indexImages: function () { var that = this; //鍥剧墖棰勫姞杞 $.preload(that.AllImgLoad, { // 鏄惁鏈夊簭鍔犺浇 order: true, minTimer: 0, //姣忓姞杞藉畬涓€寮犳墽琛岀殑鏂规硶 each: function (count) { $('.data2').eq(count).append(''); }, // 鍔犺浇瀹岄灞忓墿涓嬬殑鍥剧墖鎵ц鐨勬柟娉 end: function () { console.log('鍔犺浇瀹屼簡棣栧睆鍏朵粬banner'); that.BannerSwiper(); if (that.AllImgFalse.length > 0) { //鏃犲簭鍔犺浇缃戠珯鍏ㄩ儴鐨勫浘鐗囷紝灏戜簬1寮犱笉鍔犺浇 that.allImages(); } } }); }, //缃戠珯鍏ㄩ儴鍥剧墖鏃犲簭鍔犺浇 allImages: function () { var that = this; //鍥剧墖棰勫姞杞 $.preload(that.AllImgFalse, { // 鏄惁鏈夊簭鍔犺浇 order: false, minTimer: 0, //姣忓姞杞藉畬涓€寮犳墽琛岀殑鏂规硶 each: function (count) { $('.data3').eq(count).append(''); }, // 鍔犺浇瀹岄灞忓墿涓嬬殑鍥剧墖鎵ц鐨勬柟娉 end: function () { console.log('鍔犺浇瀹屼簡鍏ㄩ儴'); } }); } }; $(function () { IqwXiongJs.Init(); });