$(document).ready(function(){ //鑿滃崟鏍 // var t = {}; // $('.nav li').hover(function(){ // var _this = this // $(this).find('.first').slideToggle(); // // $(this).find('.first').hover(function(){ // // // if(t != undefined){ // // // clearTimeout(t); // // // } // // if(t != undefined){ // // clearTimeout(t); // // } // // // console.log(1) // // // console.log(t) // // //$(this).find('.second') // // // console.log(1) // // // event.stopPropagation(); // // },function(){ // // //t = setTimeout(function() {$(_this).find('.second').hide();}, 500); // // // t = setTimeout(function() {$(_this).find('.first').hide();}, 3000); // // // console.log(2) // // // console.log(t) // // // $(this).find('.first').off('mouseenter').unbind('mouseleave'); // // // event.stopPropagation(); // // }); // // $(this).find('.first').children('div').hover(function(){ // // $(this).find('.second').show(); // // },function(){ // // $(this).find('.second').hide(); // // }); // },function(){ // var _this = this // $(_this).find('.first').slideToggle(); // //t = setTimeout(function() {$(_this).find('.first').hide();}, 500); // // console.log(3) // // console.log(t) // //$(this).find('.first').off('mouseenter').unbind('mouseleave'); // }); var sum = 1; showslides(sum); $('.leftArrow').on('click',function(){ sum--; showslides(); }); $('.rightArrow').on('click',function(){ sum++; showslides(); }); $('.dot-li').on('click',function(){ sum = $(this).index()+1; showslides(); }); function showslides(){ var i; var slide = $('.mySlides'); if (sum > slide.length) { sum = 1; }else if(sum < 1){ sum = slide.length; } for(i = 0; i < slide.length; i++){ $(slide[i]).hide(); $('.dot-li')[i].style.background = ''; } $(slide[sum-1]).show(); $('.dot-li')[sum-1].style.background = '#fff'; } showslides01(); function showslides01(){ sum++; showslides(); setTimeout(showslides01,4000); } }); function mySwipers(){ var _client = document.body.clientWidth; if(mySwiper){ mySwiper.removeAllSlides(); } if(_client < 420){ mySwiper = new Swiper('.swiper-container',{ autoplay:true, slidesPerView : 1, slidesPerGroup : 3, pagination :{ el: '.pagination', clickable :true, } }); }else if(_client < 650){ mySwiper = new Swiper('.swiper-container',{ autoplay:true, slidesPerView : 2, slidesPerGroup : 3, pagination :{ el: '.pagination', clickable :true, } }); }else if(_client < 950){ mySwiper = new Swiper('.swiper-container',{ autoplay:true, slidesPerView : 3, slidesPerGroup : 3, pagination :{ el: '.pagination', clickable :true, } }); }else{ mySwiper = new Swiper('.swiper-container',{ autoplay:true, slidesPerView : 4, slidesPerGroup : 3, pagination :{ el: '.pagination', clickable :true, } }); } }