$(document).ready(function() { ScollText(".his_p"); history(); }) function history() { var _ind = 0; var _len = $(".about_history .swiper-slide").length; if(_len>1){ $(".about_history .but_pub").show(); }else{ $(".about_history .but_pub").hide(); } var histopbox_swiper = new Swiper('.about_history .swiper-container', { nextButton: '.about_history .swiper-button-next', prevButton: '.about_history .swiper-button-prev', slidesPerView:6, spaceBetween : 0, breakpoints: { 1024: { slidesPerView: 5, }, 767: { slidesPerView: 2, } } }); btnJudge(); $(".about_history .swiper-button-prev").click(function() { _ind--; btnJudge() $(".about_history .swiper-slide").eq(_ind).addClass("on").siblings().removeClass("on"); $(".about_history .swiper-slide.on").click(); $(".his-cons li").eq(_ind).show().siblings().hide(); }) $('.about_history .swiper-button-next').click(function() { _ind++; btnJudge() $(".about_history .swiper-slide").eq(_ind).addClass("on").siblings().removeClass("on"); $(".about_history .swiper-slide.on").click(); $(".his-cons li").eq(_ind).show().siblings().hide(); }) $(".about_history .swiper-slide").click(function(){ _ind = $(this).index(); $(this).addClass("on").siblings().removeClass("on"); btnJudge(); $(".his-cons li").eq(_ind).show().siblings().hide(); }) $(".about_history .swiper-slide").eq(0).click(); function btnJudge() { if(_ind >= _len - 1) { $('.about_history .swiper-button-next').addClass("disabled") _ind = _len - 1; } else { $('.about_history .swiper-button-next').removeClass("disabled") } if(_ind <= 0) { $(".about_history .swiper-button-prev").addClass("disabled") _ind = 0; } else { $(".about_history .swiper-button-prev").removeClass("disabled") } } }