Itulautusi
Faʻamaumauga ma faʻataʻitaʻiga mo le faʻaalia o le itulau e faʻaalia ai se faasologa o mea e fesoʻotai i ai o loʻo iai i luga o le tele o itulau.
Vaaiga lautele
Matou te fa'aogaina se poloka tele o so'otaga fa'afeso'ota'i mo la matou fa'asinomaga, e faigata ai ona misia so'otaga ma fa'afaigofie ona fa'asa'oina—i taimi uma e tu'uina atu ai vaega tetele e lavea. Ua fausia le fa'asinomaga i elemene HTML lisi ina ia mafai ai e le au faitau mata ona fa'ailoa le numera o feso'ota'iga avanoa. Fa'aaogā se <nav>
elemene afifi e fa'ailoa ai o se vaega fa'atautaiga e su'e ai le au faitau ma isi tekonolosi fesoasoani.
E le gata i lea, talu ai o itulau e foliga mai e sili atu ma le tasi ia vaega faʻatautaia, e fautuaina le tuʻuina atu o se faʻamatalaga aria-label
e <nav>
atagia ai lona faʻamoemoe. Mo se faʻataʻitaʻiga, afai e faʻaogaina le vaega o le pagination e faʻatautaia ai i le va o se seti o suʻesuʻega, o se igoa talafeagai e mafai ona 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>
Galulue ma ata
Su'e e fa'aoga se atigipusa po'o se fa'ailoga e suitulaga i tusitusiga mo nisi o feso'ota'iga i le itulau? Ia mautinoa e tu'u sa'o le lagolago lau faitau mata ma aria
uiga.
<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>
Malo le atoatoa ma toaga
O so'otaga fa'aigoaina e mafai ona fa'avasegaina mo tulaga eseese. Fa'aoga .disabled
mo so'oga e foliga mai e le mafai ona kiliki ma fa'ailoa .active
le itulau o lo'o iai nei.
A'o .disabled
fa'aoga e le vasega pointer-events: none
e taumafai e fa'amalo le feso'ota'iga o <a>
le s, e le'i fa'ata'atia le mea totino a le CSS ma e le'o fa'atatauina le ta'avale keyboard. E pei o lea, e tatau ona e faʻaopoopo i taimi uma tabindex="-1"
i luga o fesoʻotaʻiga faʻaletonu ma faʻaaoga le JavaScript masani e faʻamalo atoatoa ai a latou galuega.
<nav aria-label="...">
<ul class="pagination">
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">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>
E mafai ona e suitulaga ese taula malosi pe le atoatoa mo <span>
, pe aveese le taula i le tulaga o le muamua / aū e sosoo ai, e aveese ai le kilikiina o galuega ma puipuia le taulai atu o le piano a'o taofi sitaili fuafuaina.
<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>
Tele
Mana'o e lapopo'a pe la'ititi itulau? Fa'aopoopo .pagination-lg
pe .pagination-sm
mo isi lapopo'a.
<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>
Fa'atonuga
Suia le fa'aogaina o vaega fa'akomepiuta fa'atasi ma le flexbox utilities .
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-center">
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">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" href="#" tabindex="-1" aria-disabled="true">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>
Sass
Fuafuaga
$pagination-padding-y: .375rem;
$pagination-padding-x: .75rem;
$pagination-padding-y-sm: .25rem;
$pagination-padding-x-sm: .5rem;
$pagination-padding-y-lg: .75rem;
$pagination-padding-x-lg: 1.5rem;
$pagination-color: $link-color;
$pagination-bg: $white;
$pagination-border-width: $border-width;
$pagination-border-radius: $border-radius;
$pagination-margin-start: -$pagination-border-width;
$pagination-border-color: $gray-300;
$pagination-focus-color: $link-hover-color;
$pagination-focus-bg: $gray-200;
$pagination-focus-box-shadow: $input-btn-focus-box-shadow;
$pagination-focus-outline: 0;
$pagination-hover-color: $link-hover-color;
$pagination-hover-bg: $gray-200;
$pagination-hover-border-color: $gray-300;
$pagination-active-color: $component-active-color;
$pagination-active-bg: $component-active-bg;
$pagination-active-border-color: $pagination-active-bg;
$pagination-disabled-color: $gray-600;
$pagination-disabled-bg: $white;
$pagination-disabled-border-color: $gray-300;
$pagination-transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
$pagination-border-radius-sm: $border-radius-sm;
$pagination-border-radius-lg: $border-radius-lg;
Mixins
@mixin pagination-size($padding-y, $padding-x, $font-size, $border-radius) {
.page-link {
padding: $padding-y $padding-x;
@include font-size($font-size);
}
.page-item {
@if $pagination-margin-start == (-$pagination-border-width) {
&:first-child {
.page-link {
@include border-start-radius($border-radius);
}
}
&:last-child {
.page-link {
@include border-end-radius($border-radius);
}
}
} @else {
//Add border-radius to all pageLinks in case they have left margin
.page-link {
@include border-radius($border-radius);
}
}
}
}