$(function(){ $(".header-IntoNav .sou").click(function(){ $(".souDiv").fadeIn(); }); $(".souClose").click(function(){ $(".souDiv").fadeOut(); }); $(".souInput ._span").click(function(){ var href = location.origin; var val = $(".souInput input").val(); location.href = href + '/search?name=' + val; }); var testingType = new Swiper('.testing_type', { slidesPerView : 4.5, spaceBetween : 2, }); $(".page_item").click(function(){ $(".other_page").show(); }) $(".other_page a").click(function(e){ e.stopPropagation(); $(".other_page").hide(); page_init = $(this).index(); curPage(); }); var page_init = 0; function curPage(){ $(".other_page a").eq(page_init).addClass('active').siblings().removeClass('active'); $(".cur_page").text($(".other_page a").eq(page_init).text()); if(page_init<=0){ $(".testing_prev").addClass('no_more'); $(".testing_next").removeClass('no_more'); }else if(page_init>=$(".other_page a").length-1){ $(".testing_prev").removeClass('no_more'); $(".testing_next").addClass('no_more'); }else{ $(".testing_prev").removeClass('no_more'); $(".testing_next").removeClass('no_more'); } } $(".testing_prev").click(function(){ if(page_init>0){ page_init--; curPage(); }else{ page_init = 0; } }) $(".testing_next").click(function(){ if(page_init<$(".other_page a").length-1){ page_init++; curPage(); }else{ page_init = $(".other_page a").length-1; } }) })