Tīpoka ki te ihirangi matua Tīpoka ki te whakaterenga tuhinga
in English

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-labelhei <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 ariahuanga.

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

Ko nga ahuatanga haua me te hohe

Ko nga hononga whakaingoatanga he mea whakarite mo nga ahuatanga rereke. Whakamahia .disabledmo nga hononga kaore e taea te panui me .activete tohu i te wharangi o naianei.

Ahakoa e whakamahi ana te karaehe ki .disabledte 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" 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>

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

<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

Taurangi

$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;

Whakaranu

@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);
      }
    }
  }
}