Pagination
Inyandiko n'ingero zo kwerekana pagination kwerekana urukurikirane rw'ibirimo bifitanye isano bibaho kurupapuro rwinshi.
Incamake
Dukoresha umurongo munini uhuza imiyoboro yacu, dukora amahuza bigoye kubura kandi byoroshye - byose mugihe dutanga ahantu hanini cyane. Pagination yubatswe nurutonde rwa HTML kugirango abasomyi ba ecran bashobore gutangaza umubare wibihuza bihari. Koresha ikintu cyo gupfunyika <nav>
kugirango umenye nkigice cyo kugendamo kugirango usome abasomyi nubundi buryo bwikoranabuhanga bufasha.
Mubyongeyeho, nkurupapuro rushobora kuba rufite igice kirenze kimwe cyo kugendagenda, nibyiza gutanga ibisobanuro aria-label
kugirango <nav>
Uwiteka agaragaze intego yacyo. Kurugero, niba ibice bya pagination bikoreshwa mukugenda hagati yishakisha ryibisubizo, ikirango gikwiye gishobora aria-label="Search results pages"
.
<nav aria-label="Page navigation example">
<ul class="pagination">
<li class="page-item"><a class="page-link" href="#">Previous</a></li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item"><a class="page-link" href="#">Next</a></li>
</ul>
</nav>
Gukorana n'amashusho
Urashaka gukoresha igishushanyo cyangwa ikimenyetso mu mwanya winyandiko kuri pagination zimwe? Wemeze gutanga ibisobanuro bikwiye byabasomyi hamwe aria
nibiranga.
<nav aria-label="Page navigation example">
<ul class="pagination">
<li class="page-item">
<a class="page-link" href="#" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item">
<a class="page-link" href="#" aria-label="Next">
<span aria-hidden="true">»</span>
</a>
</li>
</ul>
</nav>
Abamugaye kandi bakora
Guhuza paji birashobora guhindurwa mubihe bitandukanye. Koresha .disabled
amahuza agaragara adashobora gukanda no .active
kwerekana page iriho.
Mugihe .disabled
icyiciro gikoresha pointer-events: none
kugirango ugerageze guhagarika imikorere yimikorere ya <a>
s, uwo mutungo wa CSS nturashyirwaho kandi ntubara inzira ya clavier. Nkibyo, ugomba guhora wongeyeho tabindex="-1"
kumurongo wamugaye kandi ugakoresha JavaScript yihariye kugirango uhagarike imikorere yabo.
<nav aria-label="...">
<ul class="pagination">
<li class="page-item disabled">
<a class="page-link">Previous</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item active" aria-current="page">
<a class="page-link" href="#">2</a>
</li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
</nav>
Urashobora guhitamo guhinduranya ibikorwa cyangwa byahagaritswe inanga ya <span>
, cyangwa gusiba inanga mugihe cyambere / ubutaha imyambi, kugirango ukureho imikorere yo gukanda no gukumira icyerekezo cya clavier mugihe ugumana uburyo bugenewe.
- Mbere
- 1
- 2
- 3
- Ibikurikira
<nav aria-label="...">
<ul class="pagination">
<li class="page-item disabled">
<span class="page-link">Previous</span>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item active" aria-current="page">
<span class="page-link">2</span>
</li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
</nav>
Ingano
Ibyiza binini cyangwa bito? Ongeraho .pagination-lg
cyangwa .pagination-sm
kubunini bwinyongera.
<nav aria-label="...">
<ul class="pagination pagination-lg">
<li class="page-item active" aria-current="page">
<span class="page-link">1</span>
</li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
</ul>
</nav>
<nav aria-label="...">
<ul class="pagination pagination-sm">
<li class="page-item active" aria-current="page">
<span class="page-link">1</span>
</li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
</ul>
</nav>
Guhuza
Hindura guhuza ibice bya pagination hamwe nibikoresho bya flexbox .
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-center">
<li class="page-item disabled">
<a class="page-link">Previous</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
</nav>
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-end">
<li class="page-item disabled">
<a class="page-link">Previous</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
</nav>