whakawhārangi
Ko nga tuhinga me nga tauira mo te whakaatu whakaingoatanga hei tohu i te raupapa o nga ihirangi e pa ana ki nga wharangi maha.
Tirohanga
Ka whakamahia e matou he poraka nui o nga hononga hono mo to maatau whakaingoatanga, he mea uaua ki te ngaro nga hononga me te ngawari ki te tauine—i te wa e whakarato ana i nga waahi nui. Ka hangaia te whakaingoatanga me nga huānga HTML rarangi kia taea ai e nga kaipanui mata te panui te maha o nga hononga e waatea ana. Whakamahia he <nav>
huānga takai hei tohu hei waahanga whakatere hei tirotiro i nga kaipānui me etahi atu hangarau awhina.
I tua atu, i te mea he nui ake i te kotahi te waahanga whakaterenga o nga wharangi, he mea tika kia homai he whakamaarama aria-label
hei <nav>
whakaatu i tana kaupapa. Hei tauira, ki te whakamahia te wahanga whakaingoatanga ki te whakatere i waenga i te huinga o nga hua rapu, he tapanga tika pea ko 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>
Te mahi me nga tohu
Kei te titiro ki te whakamahi tohu, tohu ranei hei whakakapi i te tuhinga mo etahi hononga whakaingoatanga? Kia kaha ki te whakarato i te tautoko kaipānui mata tika me nga aria
huanga.
<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>
Ko nga ahuatanga haua me te hohe
Ko nga hononga whakaingoatanga he mea whakarite mo nga ahuatanga rereke. Whakamahia .disabled
mo nga hononga kaore e taea te panui me .active
te tohu i te wharangi o naianei.
Ahakoa e whakamahi ana te karaehe ki .disabled
te whakakore i te taumahinga hono a s, ko taua taonga CSS kaore ano kia whakatauritehia, kaore hoki e whai whakaaro mo te whakatere papapātuhi. Na, me taapiri tonu koe ki nga hononga haua me te whakamahi i te JavaScript ritenga hei whakakore i a raatau mahi.pointer-events: none
<a>
tabindex="-1"
<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>
Ka taea e koe te huri i nga punga hohe, haua ranei mo te <span>
, waiho ranei te punga i roto i te keehi o nga pere o mua/muri, hei tango i te mahi paato me te aukati i te arotahi papapātuhi i te wa e pupuri ana i nga momo kua whakaritea.
<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>
Te rahinga
Kei te pirangi koe ki te wharangi nui, iti ake ranei? Tāpirihia mo etahi atu rahinga .pagination-lg
ranei ..pagination-sm
<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>
Tirohanga
Hurihia te tirohanga o nga waahanga whakaingoatanga me nga taputapu flexbox . Hei tauira, me .justify-content-center
:
<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>
Me .justify-content-end
:
<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>
CSS
Taurangi
Kua taapirihia ki te v5.2.0Hei waahanga o te huarahi rerekee CSS a Bootstrap, ka whakamahia e te whakaingoatanga inaianei nga taurangi CSS rohe .pagination
mo te whakapai ake i nga whakaritenga o te waa. Ko nga uara mo nga taurangi CSS ka whakatauhia ma te Sass, no reira kei te tautoko tonu te whakaritenga Sass.
--#{$prefix}pagination-padding-x: #{$pagination-padding-x};
--#{$prefix}pagination-padding-y: #{$pagination-padding-y};
@include rfs($pagination-font-size, --#{$prefix}pagination-font-size);
--#{$prefix}pagination-color: #{$pagination-color};
--#{$prefix}pagination-bg: #{$pagination-bg};
--#{$prefix}pagination-border-width: #{$pagination-border-width};
--#{$prefix}pagination-border-color: #{$pagination-border-color};
--#{$prefix}pagination-border-radius: #{$pagination-border-radius};
--#{$prefix}pagination-hover-color: #{$pagination-hover-color};
--#{$prefix}pagination-hover-bg: #{$pagination-hover-bg};
--#{$prefix}pagination-hover-border-color: #{$pagination-hover-border-color};
--#{$prefix}pagination-focus-color: #{$pagination-focus-color};
--#{$prefix}pagination-focus-bg: #{$pagination-focus-bg};
--#{$prefix}pagination-focus-box-shadow: #{$pagination-focus-box-shadow};
--#{$prefix}pagination-active-color: #{$pagination-active-color};
--#{$prefix}pagination-active-bg: #{$pagination-active-bg};
--#{$prefix}pagination-active-border-color: #{$pagination-active-border-color};
--#{$prefix}pagination-disabled-color: #{$pagination-disabled-color};
--#{$prefix}pagination-disabled-bg: #{$pagination-disabled-bg};
--#{$prefix}pagination-disabled-border-color: #{$pagination-disabled-border-color};
Taurangi Sass
$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-font-size: $font-size-base;
$pagination-color: var(--#{$prefix}link-color);
$pagination-bg: $white;
$pagination-border-radius: $border-radius;
$pagination-border-width: $border-width;
$pagination-margin-start: ($pagination-border-width * -1);
$pagination-border-color: $gray-300;
$pagination-focus-color: var(--#{$prefix}link-hover-color);
$pagination-focus-bg: $gray-200;
$pagination-focus-box-shadow: $input-btn-focus-box-shadow;
$pagination-focus-outline: 0;
$pagination-hover-color: var(--#{$prefix}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;
Sass mixins
@mixin pagination-size($padding-y, $padding-x, $font-size, $border-radius) {
--#{$prefix}pagination-padding-x: #{$padding-x};
--#{$prefix}pagination-padding-y: #{$padding-y};
@include rfs($font-size, --#{$prefix}pagination-font-size);
--#{$prefix}pagination-border-radius: #{$border-radius};
}