主要功能 上一页 下一页 以及输入指定页码进行跳转
主要逻辑:
当页码数小于1时 页码数为1
当页码数大于总条数时 页码数为当前总条数
仅供参考 自我记录
.
HTML代码
<!-- 分页 -->
<div class="page_box">
<button class="id_top"></button> <!-- 上一页 -->
<input type="text" id="page_text" value="1" /> <!-- 可输入页码 -->
<button class="id_next"></button> <!-- 下一页 -->
<span>/ </span>
<span id="id_total">10</span> <!-- 显示总页数 -->
</div>
less代码
*{
margin: 0;
padding: 0;
text-decoration: none;
list-style: none;
box-sizing: border-box;
}
/*分页*/
.page_box {
width: 150px;
height: 24px;
line-height: 24px;
background: #273559;
margin: 200px auto;
.id_top {
float: left;
width: 24px;
height: 24px;
border: 1px solid #445789;; //自定义边框
outline: none; //消除默认点击蓝色边框效果
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAMRklEQVR4Xu2d7Y8dVR3Hv7/b7pypqciDJUGk6GJ9CKlQhBeoBBHQF4pCImBJrDEkVQsFiZSduS12rcJiLdHwpI2wUQyl9gUJYGICFjA+vYEKL4pi78wuttH4F3R3695j7hbalO3uzp09M3Mevvet5/zO7/f5nk8u7OAdAT8kQAJzEhCyIQESmJsABeHtIIF5CFAQXg8SoCC8AyRQjgC/Qcpx465ACFCQQILmmOUIUJBy3LgrEAIUJJCgOWY5AhSkHDfuCoQABQkkaI5ZjgAFKceNuwIhQEECCZpjliNAQcpx465ACFCQQILmmOUIUJBy3LgrEAIUJJCgOWY5AhSkHDfuCoQABQkkaI5ZjgAFKceNuwIhQEECCZpjliNAQcpx465ACFCQQILmmOUIUJBy3LgrEAIUJJCgOWY5AhSkHDfuCoQABQkkaI5ZjgAFKceNuwIhQEECCZpjliNAQcpx465ACFCQQILmmOUIUJBy3LgrEAIUJJCgOWY5AhSkHDfuCoQABQkkaI5ZjgAFKceNuwIhQEECCZpjliNAQcpx465ACFCQQILmmOUIUJBy3Nzdtf7lgfj0Uy/rQi57e4iWyAsTI4N/dHeo6j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EKYook63hJgIJ4GSuHMkWAgpgiyTpeEqAgXsbKoUwRoCCmSLKOlwQoiJexcihTBCiIKZKs4yUBCuJlrBzKFAEKYook63hJgIJ4GSuHMkWAgpgiyTpeEqAgXsbKoUwRoCCmSLKOlwQoiJexcihTBCiIKZKs4yUBCuJlrBzKFAEKYook63hJgIJ4GSuHMkWAgpgiyTpeEqAgXsbKoUwRoCCmSLKOlwQoiJexcihTBCiIKZKs4yUBCuJlrBzKFAEKYook63hJgIJ4GSuHMkWAgpgiyTpeEqAgXsbKoUwRoCCmSLKOlwQoiJexcihTBCiIKZKs4yUBCuJlrBzKFAEKYook63hJ4P8cX8v2lroKWAAAAABJRU5ErkJggg==) no-repeat center;
background-size: 26px;
border-radius: 2px;
&:hover {
cursor: pointer;
/*光标呈现为指示链接的指针(一只手)*/
}
}
input {
float: left;
width: 28px;
height: 24px;
border: 1px solid #445789;
border-radius: 2px;
margin-left: 18px;
margin-right: 9px;
text-align: center;
font-size: 16px;
outline: none;
color: #fff;
background: #273559;
vertical-align:middle;
}
span{
color: #fff;
line-height: 24px;
}
.id_next {
float: right;
width: 24px;
height: 24px;
border: 1px solid #445789; //自定义边框
outline: none; //消除默认点击蓝色边框效果
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAL7UlEQVR4Xu2dbYxUVxnHnzMrDE38avQDTdy5dwAh+gFJk/oWCtoXo/jB+FYtll2r0hi1dtOw0NZB2TkXtqQFo2J9a4OkKfaDUZNCqdIEtRpaX9LQ0qxsQWI0Glvkbe+5s3sfM7tDLZRl7p65576c89+ve55z7/P7P7+czNzdGUH4AQEQmJWAABsQAIHZCUAQTAcIXIEABMF4gAAEwQyAgB4BnCB63FDlCAEI4kjQaFOPAATR44YqRwhAEEeCRpt6BCCIHjdUOUIAgjgSNNrUIwBB9LihyhECEMSRoNGmHgEIoscNVY4QgCCOBI029QhAED1uqHKEAARxJGi0qUcAguhxQ5UjBCCII0GjTT0CEESPG6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We7Hc0ePukxCAILNQqm4Yv56Jr73wa1GhZ9T88ABeayQZK3vWQBB7skQnBghAEANQsaU9BCCIPVmiEwMEIIgBqNjSHgIQxJ4s0YkBAhDEAFRsaQ8BCGJPlujEAAEIYgAqtrSHAASxJ0t0YoAABDEAFVvaQwCC2JMlOjFAAIIYgIot7SEAQezJEp0YIABBDEDFlvYQgCD2ZIlODBCAIAagYkt7CEAQe7JEJwYIQBADULGlPQQgiD1ZohMDBCCIAajY0h4CEMSeLNGJAQIQxABUbGkPAQhiT5boxAABCGIAKra0hwAEsSdLdGKAAAQxABVb2kMAgtiTJToxQACCGICKLe0hAEHsyRKdGCAAQQxAxZb2EIAg9mSJTgwQgCAGoGJLewhAEHuyRCcGCEAQA1CxpT0EIIg9WaITAwQgiAGo2NIeAhDEnizRiQECEMQAVGxpDwEIYk+W6MQAgf8BLAur9nV6QzoAAAAASUVORK5CYII=) no-repeat center;
background-size: 26px;
border-radius: 2px;
&:hover {
cursor: pointer;
/*光标呈现为指示链接的指针(一只手)*/
}
}
}
css代码
/*初始化*/
* {
margin: 0;
padding: 0;
text-decoration: none;
list-style: none;
box-sizing: border-box;
}
/*分页*/
.page_box {
width: 150px;
height: 24px;
line-height: 24px;
background: #273559;
margin: 200px auto;
}
.page_box .id_top {
float: left;
width: 24px;
height: 24px;
border: 1px solid #445789;
outline: none;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAMRklEQVR4Xu2d7Y8dVR3Hv7/b7pypqciDJUGk6GJ9CKlQhBeoBBHQF4pCImBJrDEkVQsFiZSduS12rcJiLdHwpI2wUQyl9gUJYGICFjA+vYEKL4pi78wuttH4F3R3695j7hbalO3uzp09M3Mevvet5/zO7/f5nk8u7OAdAT8kQAJzEhCyIQESmJsABeHtIIF5CFAQXg8SoCC8AyRQjgC/Qcpx465ACFCQQILmmOUIUJBy3LgrEAIUJJCgOWY5AhSkHDfuCoQABQkkaI5ZjgAFKceNuwIhQE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XSzgdEOTaqJ8zB8/pSBWk6WoCBOxrZw0yrpbIfIpoVXzrdCNk2ODO5YXA23d1MQt/Obt/sozRIBRkqOuG9STVwa8rdHjxsFKXl7XNkWJ531WmRnn/3u11h6w9TIua/3uc+75RTEu0hnDxSlnWsFra2ALvIqhr0aS2+jHEc5UpAABJkZsfcXrsnuVg2sO/mLfSSH4JHJewfvDwVJkTkpSBFKPq0Z3h+pqfhq3cXFb48lkL9O3jf4nE9jmpqFgpgiyTpeEqAgXsbKoUwRoCCmSLKOlwQoiJexcihTBCiIKZKs4yUBCuJlrBzKFAEKYook63hJgIJ4GSuHMkWAgpgiyTpeEqAgXsbKoUwRoCCmSLKOlwQoiJexcihTBCiIKZKs4yUBCuJlrBzKFAEKYook63hJgIJ4GSuHMkWAgpgiyTpeEqAgXsbKoUwRoCCmSLKOlwQoiJexcihTBCiIKZKs4yUBCuJlrBzKFAEKYook63hJgIJ4GSuHMkWAgpgiyTpeEqAgXsbKoUwRoCCmSLKOlwQoiJexcihTBCiIKZKs4yUBCuJlrBzKFAEKYook63hJgIJ4GSuHMkWAgpgiyTpeEqAgXsbKoUwRoCCmSLKOlwQoiJexcihTBCiIKZKs4yUBCuJlrBzKFAEKYook63hJ4P8cX8v2lroKWAAAAABJRU5ErkJggg==) no-repeat center;
background-size: 26px;
border-radius: 2px;
}
.page_box .id_top:hover {
cursor: pointer;
/*光标呈现为指示链接的指针(一只手)*/
}
.page_box input {
float: left;
width: 28px;
height: 24px;
border: 1px solid #445789;
border-radius: 2px;
margin-left: 18px;
margin-right: 9px;
text-align: center;
font-size: 16px;
outline: none;
color: #fff;
background: #273559;
vertical-align: middle;
}
.page_box span {
color: #fff;
line-height: 24px;
}
.page_box .id_next {
float: right;
width: 24px;
height: 24px;
border: 1px solid #445789;
outline: none;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAL7UlEQVR4Xu2dbYxUVxnHnzMrDE38avQDTdy5dwAh+gFJk/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xCDr0GEqKwLm/0PYczKTcDpE2TexrHlFa48m3KEp4nELUrWfp7yvtguBwJOC3LVXWML475Kem+5Mo2JPhoIR7zf5JAlLmmAgNOCUOPI/Kpa0P6npIW9smWiPxDFA5GsP9/rXqgvDgG3BSGi6vD4EBGP9hQJ0+NvmKoMnBvt/2dP+6C4cAScF6RzijxNRMt10mGiPVE1HKDGskinHjXFJgBBiGj+8Imlgib3EtGyucXF31LS//LcarC6TAQgSCetjiQ7iWh1twAFiVdi5h1R4G3utha/LzcBCHJJftWN43cS0+1EXLs0WiZ6WRA9SlNih9pWe7Hc0ePukxCAILNQqm4Yv56Jr73wa1GhZ9T88ABeayQZK3vWQBB7skQnBghAEANQsaU9BCCIPVmiEwMEIIgBqNjSHgIQxJ4s0YkBAhDEAFRsaQ8BCGJPlujEAAEIYgAqtrSHAASxJ0t0YoAABDEAFVvaQwCC2JMlOjFAAIIYgIot7SEAQezJEp0YIABBDEDFlvYQgCD2ZIlODBCAIAagYkt7CEAQe7JEJwYIQBADULGlPQQgiD1ZohMDBCCIAajY0h4CEMSeLNGJAQIQxABUbGkPAQhiT5boxAABCGIAKra0hwAEsSdLdGKAAAQxABVb2kMAgtiTJToxQACCGICKLe0hAEHsyRKdGCAAQQxAxZb2EIAg9mSJTgwQgCAGoGJLewhAEHuyRCcGCEAQA1CxpT0EIIg9WaITAwQgiAGo2NIeAhDEnizRiQECEMQAVGxpDwEIYk+W6MQAgf8BLAur9nV6QzoAAAAASUVORK5CYII=) no-repeat center;
background-size: 26px;
border-radius: 2px;
}
.page_box .id_next:hover {
cursor: pointer;
/*光标呈现为指示链接的指针(一只手)*/
}
JQ代码
// 使用 Google 的 CDN
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>
<script>
$(function () {
var that_input_value = '1' //默认input val
$("#page_text").change(function () {
let input_val = Number($(this).val())
let total = Number($('#id_total').text())
console.log(input_val, total);
if (input_val < total) {
$(this).val(input_val)
} else {
input_val = total
$(this).val(input_val)
}
if (input_val < 1) {
$(this).val(1)
}
that_input_value = $(this).val()
console.log(that_input_value,'每次change input的值');
});
$('.page_box>.id_top').click(function () {
let i = Number($(this).next().val())
if (i > 1) {
i--;
$(this).next().val(i)
} else {
i = 1;
$(this).next().val(i)
}
console.log(i, 'top');
})
$('.page_box>.id_next').click(function () {
let i = Number($(this).prev().val())
let total = Number($('#id_total').text())
if (i < total) {
i++;
$(this).prev().val(i)
} else {
i = total
$(this).prev().val(i)
}
console.log(i, 'id_next')
});
});
</script>