// WOW动画 if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))) { new WOW().init(); }; jQuery(window).scroll(function() { var windowTop = $(window).scrollTop(); if (windowTop > 0) { jQuery(".header").addClass("fixed"); jQuery(".index-nav").addClass("index-navhide"); } else { jQuery(".header").removeClass("fixed"); jQuery(".index-nav").removeClass("index-navhide"); } }); $(function(){ var page_heig = $(document).scrollTop(); /* 初始化。用于第一次获取滚动条的高度 */ var navigation = $('.header').outerHeight(); /* 获取该元素的高度 */ $(window).scroll(function() { /* 滚动条触发事件 */ var real_heig = $(document).scrollTop(); /* 事件触发后获取滚动条高度 */ if (real_heig > navigation){ /* 触发后的高度 与 元素的高度对比 */ $('.header').addClass('miss'); /* True 添加隐藏属性 */ }else { $('.header').removeClass('miss'); /* False 删除隐藏属性 */ } if (real_heig < page_heig){ /* 触发后的高度 与 上次触发后的高度 */ $('.header').removeClass('miss'); /* True 删除隐藏属性 */ } page_heig = $(document).scrollTop(); /* 再次获取滚动条的高度,用于下次触发事件后的对比 */ }); }); // 首页轮播图 var upsSwiper = new Swiper('#banner .swiper-container', { speed: 1000, longSwipes: false, loop: true, height : window.innerHeight, autoplay: { disableOnInteraction: false, delay:3000, }, navigation: { nextEl: '.banner-next', prevEl: '.banner-prev', }, pagination: { el: '.pagination1', clickable: true, } }); swiperHeight = upsSwiper.height; $("#banner").mouseenter(function () {//滑过悬停 upsSwiper.autoplay.stop();//upsSwiper 为上面你swiper实例化的名称 }).mouseleave(function(){//离开开启 upsSwiper.autoplay.start(); }); // 首页产品 var indexProductSwiper = new Swiper('.index-product-swiper', { slidesPerView: 1, autoplay: true, loop: true, pagination: { el: '.product-pagination', clickable: true, }, navigation: { nextEl: '.product-next', prevEl: '.product-prev', }, }); $(".index-product-swiper").mouseenter(function () {//滑过悬停 indexProductSwiper.autoplay.stop();//indexProductSwiper 为上面你swiper实例化的名称 }).mouseleave(function(){//离开开启 indexProductSwiper.autoplay.start(); }); // 首页方案 var solutionSwiper = new Swiper('.solution-swiper', { slidesPerView: 5, autoplay: true, loop: true, pagination: { el: '.pagination2', clickable: true, }, navigation: { nextEl: '.button-next', prevEl: '.button-prev', }, }); // $('.solution-swiper').hover(function(){ // solutionSwiper.autoplay.stop(); // },function(){ // solutionSwiper.autoplay.start(); // }) // 首页荣誉 var honorSwiper = new Swiper('.index-honor-list', { slidesPerView: 5, autoplay: true, loop: true, pagination: { el: '.pagination3', clickable: true, }, navigation: { nextEl: '.com-next', prevEl: '.com-prev', }, }); // 首页新闻选项 var newsTabSwiper = new Swiper('.index-news-swiper', { effect : 'fade', speed: 500, on: { slideChangeTransitionStart: function() { $(".index-news-cate .on").removeClass('on'); $(".index-news-cate li").eq(this.activeIndex).addClass('on'); } } }) $(".index-news-cate li").on('click', function(e) { e.preventDefault() $(".index-news-cate .on").removeClass('on') $(this).addClass('on') newsTabSwiper.slideTo($(this).index()) }) var useProduct = new Swiper('.sw-product', { slidesPerView: 4, slidesPerGroup: 4, autoplay: true, loop: true, pagination: { el: '.pagination-use', clickable: true, } }); var picProduct = new Swiper('.product-pic-swiper', { slidesPerView: 1, slidesPerGroup: 1, autoplay: true, loop: true, pagination: { el: '.pagination-product', clickable: true, }, navigation: { nextEl: '.common-next', prevEl: '.common-prev', } }); var scrollSwiper3 = new Swiper('.scroll-cont3', { direction: 'vertical', slidesPerView: 4, slidesPerColumn: 3, spaceBetween: 0, autoplay: true, }); // 列表荣誉 // var honorInnerSwiper = new Swiper('.inner-honor-list', { // slidesPerView: 3, // slidesPerGroup: 3, // autoplay: true, // loop: false, // pagination: { // el: '.pagination4', // clickable: true, // }, // }); // 客服 $(function(){ $('.fixed-right li').eq(1).hover(function(){ $(this).stop(true,true).animate({width:'85px',marginLeft:'-13px'},300); },function(){ $(this).stop(true,true).animate({width:'56px',marginLeft:'0px'},300); }) $('.fixed-right li.top').hover(function(){ $(this).stop(true,true).animate({width:'85px',marginLeft:'-13px'},300); },function(){ $(this).stop(true,true).animate({width:'56px',marginLeft:'0px'},300); }) $('.fixed-right li').eq(3).hover(function(){ $(this).stop(true,true).animate({width:'213px',marginLeft:'-155px'},500); },function(){ $(this).stop(true,true).animate({width:'213px',marginLeft:'0px'},500); }) $('.fixed-right li:first').hover(function(){ $(this).stop(true,true).animate({width:'85px',marginLeft:'-13px'},300,function(){$('.weixin img').stop().show()}); },function(){ $(this).stop(true,true).animate({width:'56px',marginLeft:'0px'},300,function(){$('.weixin img').stop().hide()}); }) $('.fixed-right li').eq(2).hover(function(){ $(this).stop(true,true).animate({width:'85px',marginLeft:'-13px'},300); },function(){ $(this).stop(true,true).animate({width:'56px',marginLeft:'0px'},300); }) $('.fixed-right li.top').on('click',function(){ $('html,body').stop().animate({scrollTop:0},1000) }) $('header nav li').hover(function(){ $(this).find('.con').fadeIn().stop().animate({top:70,opacity:1},300) },function(){ $(this).find('.con').fadeOut(0).stop().animate({top:80,opacity:0},0) }) }) $(function() { // 底部滑动框 // setTimeout(function() { // $('.asideBanner').eq(0).animate({ // bottom: '0px' // }, 1000) // }, 1000) $('.asideBanner .close-btn').eq(0).click(function() { $('.asideBanner').eq(0).animate({ left: -2000 }, 0, 500, 'linear'); $('.zhankai').animate({ left: 0 }, 0, 500, 'linear'); $('.foot-fast').css("height", '0'); $('.know-more').removeClass('on'); }) $('.zhankai').click(function() { $('.asideBanner').eq(0).animate({ left: 0 }, 0, 500, 'linear'); $('.zhankai').animate({ left: -200 }, 0, 500, 'linear'); }) $('.know-more').hover(function() { // if (!$(this).hasClass('on')) { // $(this).addClass('on'); // var ffHeight = $('.foot-fast .item').outerHeight(); // $('.foot-fast').css("height", ffHeight); // } else { // $(this).removeClass('on'); // $('.foot-fast').css("height", '0'); // } $(this).addClass('on'); var ffHeight = $('.foot-fast .item').outerHeight(); $('.foot-fast').css("height", ffHeight); }) $('.foot-fast').mouseleave(function(){ $('.know-more').removeClass('on'); $('.foot-fast').css("height", '0'); }) $('.foot-sub').click(function(){ var url = "/index.php?g=Contents&m=Index&a=searchselect", selOneVal = $('.foot-sel1').val(), selTwoVal = $('.foot-sel2').val(); if (selOneVal == "请选择您要的类型" || selTwoVal == "请选择您要检测的气体") { alert("请选择类型与气体名称!") } else { var goUrl = url + "&type_a=" + selOneVal + "&type_b=" + selTwoVal; window.location.href=goUrl; } }) // if ($('.index-product').length > 0) { // console.log('yes'); // var topIndexProduct = $(".index-product").offset().top; // $(document).scroll(function(e){ // if($(document).scrollTop()>topIndexProduct){ // $('.kefuBox').eq(0).animate({ // right: '-220px' // }, 500) // $('.kefuOpen').eq(0).animate({ // right: '0' // }, 500) // return false; // } // }); // } // if ($('.header-wrap').length > 0) { // setTimeout(function() { // $('.kefuBox').eq(0).animate({ // right: '-220px' // }, 500) // $('.kefuOpen').eq(0).animate({ // right: '0' // }, 500) // }, 800) // } $(".kf02-left").click(function() { $(this).toggleClass("on"); $(".kf02").toggleClass("on"); }) })