$(function(){ var swiper = new Swiper(".indexbanner .swiper-container", { autoplay: { delay: 3500,//1秒切换一次 }, speed: 1500, loop: true, navigation: { nextEl: ".indexbanner .swiper-button-next", prevEl: ".indexbanner .swiper-button-prev", }, pagination: { el: ".indexbanner .swiper-pagination", clickable: true }, on:{ init: function(){ swiperAnimateCache(this); //隐藏动画元素 swiperAnimate(this); //初始化完成开始动画 }, slideChangeTransitionEnd: function(){ swiperAnimate(this); //每个slide切换结束时也运行当前slide动画 //this.slides.eq(this.activeIndex).find('.ani').removeClass('ani'); 动画只展现一次,去除ani类名 console.log(this.activeIndex); } } }); $(window).scroll(function(){ var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; if(scrollTop > 10){ $('.hearCell').addClass('hearCell2'); $('.headertwo').addClass('headertwo2'); } else { $('.hearCell').removeClass('hearCell2'); $('.headertwo').removeClass('headertwo2'); } }); // $('.hearCell .push').click(function(){ $('.navCell .up').show(); $('.listCell').addClass('listCellTwo'); }); $('.listCell .sole, .navCell .up').click(function(){ $('.navCell .up').hide(); $('.listCell').removeClass('listCellTwo'); }); if($(window).width()>750){ if( $('.itembox .mySwiper .swiper-slide').length == 1 ){ var swiper = new Swiper(".itembox .mySwiper", { //spaceBetween: 10, slidesPerView: 1, freeMode: true, watchSlidesProgress: true }); } else if( $('.itembox .mySwiper .swiper-slide').length == 2 ){ var swiper = new Swiper(".itembox .mySwiper", { //spaceBetween: 10, slidesPerView: 2, freeMode: true, watchSlidesProgress: true }); } else if( $('.itembox .mySwiper .swiper-slide').length == 3 ){ var swiper = new Swiper(".itembox .mySwiper", { //spaceBetween: 10, slidesPerView: 3, freeMode: true, watchSlidesProgress: true }); } else if( $('.itembox .mySwiper .swiper-slide').length == 4 ){ var swiper = new Swiper(".itembox .mySwiper", { //spaceBetween: 10, slidesPerView: 4, freeMode: true, watchSlidesProgress: true }); } else if( $('.itembox .mySwiper .swiper-slide').length == 5 ){ var swiper = new Swiper(".itembox .mySwiper", { //spaceBetween: 10, slidesPerView: 5, freeMode: true, watchSlidesProgress: true }); } else if( $('.itembox .mySwiper .swiper-slide').length == 6 ){ var swiper = new Swiper(".itembox .mySwiper", { //spaceBetween: 10, slidesPerView: 6, freeMode: true, watchSlidesProgress: true }); } else { var swiper = new Swiper(".itembox .mySwiper", { //spaceBetween: 10, slidesPerView: 7, freeMode: true, watchSlidesProgress: true }); } var swiper2 = new Swiper(".itembox .mySwiper2", { spaceBetween: 10, navigation: { nextEl: ".itembox .swiper-button-next", prevEl: ".itembox .swiper-button-prev", }, thumbs: { swiper: swiper, } }); } else { if( $('.itembox .mySwiper .swiper-slide').length == 1 ){ var swiper = new Swiper(".itembox .mySwiper", { //spaceBetween: 10, slidesPerView:1, freeMode: true, watchSlidesProgress: true }); } else if( $('.itembox .mySwiper .swiper-slide').length == 2 ){ var swiper = new Swiper(".itembox .mySwiper", { //spaceBetween: 10, slidesPerView:2, freeMode: true, watchSlidesProgress: true }); } else { var swiper = new Swiper(".itembox .mySwiper", { //spaceBetween: 10, slidesPerView:3, freeMode: true, watchSlidesProgress: true }); } var swiper2 = new Swiper(".itembox .mySwiper2", { spaceBetween: 10, navigation: { nextEl: ".itembox .swiper-button-next", prevEl: ".itembox .swiper-button-prev", }, thumbs: { swiper: swiper, } }); } $(".itembox .em1").click(function(){ $(".itembox .swiper-button-next").trigger('click'); }); $(".itembox .em2").click(function(){ $(".itembox .swiper-button-prev").trigger('click'); }); if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))){ var wow = new WOW({ boxClass: 'wow', /* 执行动画的元素 class */ animateClass: 'animated', /* animate.css 动画的 class */ offset: 10, /* 距离可视区域多少开始执行动画 */ mobile: false, /* 是否在移动设备执行动画 */ live: true /* 异步加载的内容是否有效 */ }); wow.init(); }; $(".newsdatabox .left .text img").removeAttr("width"); $(".newsdatabox .left .text img").removeAttr("height"); });