Source

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".

<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 kiʻi kūpono me arianā ʻano a me ka .sr-onlypono.

<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>
        <span class="sr-only">Previous</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>
        <span class="sr-only">Next</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.

<nav aria-label="...">
  <ul class="pagination">
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1">Previous</a>
    </li>
    <li class="page-item"><a class="page-link" href="#">1</a></li>
    <li class="page-item active">
      <a class="page-link" href="#">2 <span class="sr-only">(current)</span></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.

<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">
      <span class="page-link">
        2
        <span class="sr-only">(current)</span>
      </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 helu helu nui a liʻiliʻi paha? Hoʻohui a i .pagination-lgʻole .pagination-smno nā nui ʻē aʻe.

<nav aria-label="...">
  <ul class="pagination pagination-lg">
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1">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>
  </ul>
</nav>
<nav aria-label="...">
  <ul class="pagination pagination-sm">
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1">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>
  </ul>
</nav>

Hoʻopololei

E hoʻololi i ka hoʻonohonoho ʻana o nā ʻāpana pagination me nā pono hana flexbox .

<nav aria-label="Page navigation example">
  <ul class="pagination justify-content-center">
    <li class="page-item disabled">
      <a class="page-link" href="#" tabindex="-1">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">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>