Holo i ka ʻike nui Holo i ka hoʻokele docs
Check
in English

Ka helu helu

ʻO nā palapala a me nā laʻana no ka hōʻike ʻana i ka helu helu helu e hōʻike i kahi ʻano o nā ʻike pili i loaʻa ma nā ʻaoʻao he nui.

Nānā nui

Hoʻohana mākou i kahi poloka nui o nā loulou pili no kā mākou pagination, e hana ana i nā loulou paʻakikī e nalo a maʻalahi hoʻi i hoʻonui ʻia - ʻoiai e hāʻawi ana i nā wahi pā nui. Kūkulu ʻia ka ʻaoʻao me nā mea HTML papa inoa i hiki i ka poʻe heluhelu heluhelu ke hoʻolaha i ka helu o nā loulou i loaʻa. E hoʻohana i kahi mea ʻōwili <nav>e hoʻomaopopo iā ia ma ke ʻano he ʻāpana hoʻokele e nānā i ka poʻe heluhelu a me nā ʻenehana kōkua ʻē aʻe.

Eia hou, no ka mea, ʻoi aku ka nui o nā ʻaoʻao ma mua o hoʻokahi ʻāpana hoʻokele, pono e hāʻawi i kahi wehewehe aria-labelno ka <nav>hōʻike ʻana i kāna kumu. No ka laʻana, inā hoʻohana ʻia ka ʻāpana pagination no ka hoʻokele ʻana ma waena o kahi pūʻulu o nā hopena hulina, hiki i kahi lepili kūpono ke aria-label="Search results pages".

html
<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>

Ke hana nei me nā kiʻi

Ke ʻimi nei e hoʻohana i kahi ikona a i ʻole hōʻailona ma kahi o ka kikokikona no kekahi mau loulou pagination? E hōʻoia e hāʻawi i ke kākoʻo heluhelu pale kūpono me arianā ʻano.

html
<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">&laquo;</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">&raquo;</span>
      </a>
    </li>
  </ul>
</nav>

Nā mokuʻāina kīnā ʻole a ʻeleu

Hoʻopilikino ʻia nā loulou ʻaoʻao no nā kūlana like ʻole. E hoʻohana .disabledno nā loulou i ʻike ʻia ʻaʻole hiki ke kaomi a .activehōʻike i ka ʻaoʻao o kēia manawa.

ʻOiai .disablede hoʻohana ana ka papa pointer-events: nonee hoʻāʻo e hoʻopau i ka hana loulou o <a>s, ʻaʻole i hoʻopaʻa ʻia kēlā waiwai CSS a ʻaʻole helu no ka hoʻokele keyboard. No laila, pono ʻoe e hoʻohui mau tabindex="-1"i nā loulou kīnā ʻole a hoʻohana i ka JavaScript maʻamau e hoʻopau piha i kā lākou hana.

html
<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>

Hiki iā ʻoe ke hoʻololi i nā heleuma ikaika a i ʻole nā ​​​​heleuma no <span>, a i ʻole e haʻalele i ka heleuma ma ke ʻano o nā pua mua / aʻe, e wehe i ka hana kaomi a pale i ka nānā ʻana i ka keyboard me ka mālama ʻana i nā ʻano i manaʻo ʻia.

html
<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>

Ka nui ana

Makemake ʻoe i ka pagination nui a liʻiliʻi paha? Hoʻohui a i .pagination-lgʻole .pagination-smno nā nui ʻē aʻe.

html
<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>
html
<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>

Hoʻopololei

E hoʻololi i ka hoʻonohonoho ʻana o nā ʻāpana pagination me nā pono hana flexbox . No ka laʻana, me .justify-content-center:

html
<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>

A i ʻole me .justify-content-end:

html
<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

Nā mea hoʻololi

Hoʻohui ʻia ma v5.2.0

Ma ke ʻano o ka hoʻokokoke ʻana o nā ʻano hoʻololi CSS o Bootstrap, hoʻohana ka pagination i kēia manawa i nā ʻano CSS kūloko .paginationno ka hoʻomaikaʻi ʻana i ka manawa maoli. Hoʻonohonoho ʻia nā waiwai no nā ʻano CSS ma o Sass, no laila ke kākoʻo mau ʻia nei ka hana maʻamau 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};
  

Nā hoʻololi 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};
}