$(function(){ if($(window).width()>1024){ ScollText(".hisbottom .right"); } histopSlider(); // $(".histop_slider li").click(function(){ // $(this).addClass("on").siblings().removeClass("on"); // var url = $(this).data("src"); // if(url == ""){ // return false; // }else{ // caseAjax(".hisbottom",url) // } // }) $(".histop_slider li").hover(function(){ $(this).addClass("on").siblings().removeClass("on"); var url = $(this).data("src"); if(url == ""){ return false; }else{ caseAjax(".hisbottom",url) } },function(){ }) }) // 01 function histopSlider(){ var num = 4; if($(window).width()<1366){ num = 3; } if($(window).width()<=767){ num = 1; } if($(".histop_slider li").length>num){ $(".histop_slider").addClass("cur"); $(".histop_slider .pro_but").show(); }else{ $(".histop_slider .pro_but").hide(); } var pro1 = new Swiper('.histop_slider .swiper-container', { nextButton: '.histop_slider .swiper-button-next', prevButton: '.histop_slider .swiper-button-prev', slidesPerView: num, slidesPerGroup: 1, paginationClickable: true, spaceBetween: 10, noSwiping : true, onInit: function(swiper){ var i = $('.histop_slider .swiper-slide.on').index(); // swiper.slideTo(i-1) }, onSlideChangeEnd: function(swiper) { console.log(swiper.activeIndex); } }); var _ind = 0; var _len = $(".histop_slider .swiper-slide").length; var url = $(".histop_slider .swiper-slide").eq(0).data("src"); // btnJudge(); $(".histop_slider .swiper-slide").click(function(){ _ind = $(this).index(); $(this).addClass("on").siblings().removeClass("on"); // pro1.slideTo(_ind, 1000, false); // btnJudge(); imgratio2(); imgratio(); }) // $(".histop_slider .swiper-button-prev").click(function() { // _ind--; // btnJudge() // $(".histop_slider .swiper-slide").eq(_ind).addClass("on").siblings().removeClass("on"); // $(".histop_slider .swiper-slide.on").click(); // imgratio2(); // imgratio(); // }) // $('.histop_slider .swiper-button-next').click(function() { // _ind++; // btnJudge() // $(".histop_slider .swiper-slide").eq(_ind).addClass("on").siblings().removeClass("on"); // $(".histop_slider .swiper-slide.on").click(); // imgratio2(); // imgratio(); // }) // function btnJudge() { // if(_ind >= _len - 1) { // $('.histop_slider .swiper-button-next').addClass("disabled") // _ind = _len - 1; // } else { // $('.histop_slider .swiper-button-next').removeClass("disabled") // } // if(_ind <= 0) { // $(".histop_slider .swiper-button-prev").addClass("disabled") // _ind = 0; // } else { // $(".histop_slider .swiper-button-prev").removeClass("disabled") // } // } } // 01 function hisAjax(str,url){ if (url.indexOf('?') == -1) { url += '?tm=' + Math.random(); }else { url += '&tm=' + Math.random(); } $.ajax({ url:url, success:function(msg){ $(str).html(""); $(str).append(msg); if($(window).width()>1024){ ScollText(".hisbottom .right"); } imgratio2(); imgratio(); } }); }