$(function(){ if($(".wp_paging").length>0){ $(".pagelist").css("display","flex") var perCount=parseInt($("em.per_count").text()) var pageCount=parseInt($(".all_pages").text()) var pageIndex =parseInt($(".curr_page").text()) $(".total").text("/"+$(".all_pages").text()) $(".perPage span").text(perCount) myPageInit({ pages:pageCount, currentPage: pageIndex , element: '.my-page', callback: function (page) { } }); $(document).on("click",".my-page-cell",function(){ var Count=parseInt($(".all_pages").text()) var Cpage=parseInt($(".curr_page").text()) var page=parseInt($(this).text()) var url = location.pathname; window.location.href = url.replace(/list(\d*)/gi, "list" + page); }) $(document).on("click",".my-page-prev,.my-page-next",function(){ var page=parseInt($(".my-page-checked").text()) var url = location.pathname; window.location.href = url.replace(/list(\d*)/gi, "list" + page); }) $(document).on("click",".diy .goto",function(){ var page=parseInt($(".diy input").val()) var url = location.pathname; if(page<=0 || page>perCount || isNaN(page)){ alert("请输入正确的页码") }else{ window.location.href = url.replace(/list(\d*)/gi, "list" + page); } }) } })