in English

Navbar

Nā palapala a me nā hiʻohiʻona no ke poʻomanaʻo hoʻokele ikaika a Bootstrap, ka navbar. Loaʻa i ke kākoʻo no ka branding, hoʻokele, collapse plugin, a me nā mea hou aku.

Pehea e hana ai

Eia ka mea e pono ai ʻoe e ʻike ma mua o ka hoʻomaka ʻana me ka navbar:

  • Pono nā Navbars i kahi kāʻei .navbarme .navbar-expand{-sm|-md|-lg|-xl}nā papa hāʻule pane a me nā papa kala .
  • ʻO nā Navbars a me kā lākou mau ʻike he wai ma ka paʻamau. E hoʻohana i nā pahu koho e kaupalena i ko lākou ākea ākea.
  • E hoʻohana i kā mākou papa hana hoʻokaʻawale a hoʻololi no ka hoʻomalu ʻana i ka spacing a me ke kaulike ʻana i loko o nā navbars .
  • Hoʻololi nā Navbars ma ka maʻamau, akā hiki iā ʻoe ke hoʻololi maʻalahi iā lākou e hoʻololi i kēlā. ʻO ke ʻano pane e pili ana i kā mākou Collapse JavaScript plugin.
  • Ua hūnā ʻia nā Navbars i ka wā e paʻi ai. E hoʻoikaika iā lākou e paʻi ʻia ma ka hoʻohui .d-printʻana i ka .navbar. E ʻike i ka papa hana hōʻike .
  • E hōʻoia i ka loaʻa ʻana ma o ka hoʻohana ʻana i kahi <nav>mea a i ʻole, inā e hoʻohana ana i kahi mea maʻamau e like me ka <div>, e hoʻohui i kahi role="navigation"i kēlā me kēia navbar e hoʻomaopopo maopopo iā ia he ʻāina ʻāina no nā mea hoʻohana i nā ʻenehana kōkua.
ʻO ka hopena animation o kēia māhele e pili ana i ka prefers-reduced-motionnīnau media. E ʻike i ka ʻāpana hoʻohaʻahaʻa o kā mākou palapala hiki ke komo .

Maʻiʻo i kākoʻo ʻia

Hele mai nā Navbars me ke kākoʻo i kūkulu ʻia no ka liʻiliʻi o nā ʻāpana. E koho mai i ka mea e pono ai:

  • .navbar-brandno kāu hui, huahana, a i ʻole inoa papahana.
  • .navbar-navno ka hoʻokele piha kiʻekiʻe a me ka māmā (me ke kākoʻo no nā hāʻule iho).
  • .navbar-togglerno ka hoʻohana ʻana me kā mākou plugin collapse a me nā ʻano hoʻokele hoʻokele ʻē aʻe .
  • .form-inlineno nā ʻano mana a me nā hana.
  • .navbar-textno ka hoʻohui ʻana i nā kaula kikoʻī o ka kikokikona.
  • .collapse.navbar-collapseno ka hui pū ʻana a me ka hūnā ʻana i nā maʻiʻo o ka navbar e kahi ʻāpana makua.

Eia kekahi laʻana o nā ʻāpana ʻāpana āpau i hoʻokomo ʻia i loko o kahi navbar hoʻonaʻauao māmā e hāʻule ʻakomi i ka wahi haʻi lg(nui).

<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">Navbar</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>

  <div class="collapse navbar-collapse" id="navbarSupportedContent">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Link</a>
      </li>
      <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-expanded="false">
          Dropdown
        </a>
        <div class="dropdown-menu">
          <a class="dropdown-item" href="#">Action</a>
          <a class="dropdown-item" href="#">Another action</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="#">Something else here</a>
        </div>
      </li>
      <li class="nav-item">
        <a class="nav-link disabled">Disabled</a>
      </li>
    </ul>
    <form class="form-inline my-2 my-lg-0">
      <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
    </form>
  </div>
</nav>

Hoʻohana kēia laʻana i nā papa hana kala ( bg-light) a me ka spacing ( my-2, my-lg-0, mr-sm-0, my-sm-0).

Brand

Hiki .navbar-brandke hoʻohana ʻia i ka hapa nui o nā mea, akā ʻoi aku ka maikaʻi o kahi heleuma, no ka mea e koi ana kekahi mau mea i nā papa pono a i ʻole nā ​​​​ʻano maʻamau.

<!-- As a link -->
<nav class="navbar navbar-light bg-light">
  <a class="navbar-brand" href="#">Navbar</a>
</nav>

<!-- As a heading -->
<nav class="navbar navbar-light bg-light">
  <span class="navbar-brand mb-0 h1">Navbar</span>
</nav>

ʻO ka hoʻohui ʻana i nā kiʻi i ke kiʻi e .navbar-brandkoi mau i nā kaila maʻamau a i ʻole nā ​​mea pono i ka nui kūpono. Eia kekahi mau laʻana e hōʻike ai.

<!-- Just an image -->
<nav class="navbar navbar-light bg-light">
  <a class="navbar-brand" href="#">
    <img src="/docs/4.6/assets/brand/bootstrap-solid.svg" width="30" height="30" alt="">
  </a>
</nav>
<!-- Image and text -->
<nav class="navbar navbar-light bg-light">
  <a class="navbar-brand" href="#">
    <img src="/docs/4.6/assets/brand/bootstrap-solid.svg" width="30" height="30" class="d-inline-block align-top" alt="">
    Bootstrap
  </a>
</nav>

Hoʻokumu nā loulou hoʻokele Navbar i kā mākou mau .navkoho me kā lākou papa hoʻololi ponoʻī a koi i ka hoʻohana ʻana i nā papa toggler no ke ʻano pane kūpono. E ulu pū ana ka hoʻokele ma nā navbar e noho i kahi ākea ākea e hiki ai ke hoʻopaʻa paʻa i kāu ʻike navbar.

Hiki ke hoʻohana pololei ʻia nā mokuʻāina ikaika—me .active—e hōʻike i ka ʻaoʻao o kēia manawa iā .nav-links a i ʻole nā ​​mākua .nav-itempili.

<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">Navbar</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Features</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Pricing</a>
      </li>
      <li class="nav-item">
        <a class="nav-link disabled">Disabled</a>
      </li>
    </ul>
  </div>
</nav>

A no ka mea, hoʻohana mākou i nā papa no kā mākou navs, hiki iā ʻoe ke pale i ka papa inoa-papa inoa holoʻokoʻa inā makemake ʻoe.

<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">Navbar</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
    <div class="navbar-nav">
      <a class="nav-link active" href="#">Home <span class="sr-only">(current)</span></a>
      <a class="nav-link" href="#">Features</a>
      <a class="nav-link" href="#">Pricing</a>
      <a class="nav-link disabled">Disabled</a>
    </div>
  </div>
</nav>

Hiki iā ʻoe ke hoʻohana i nā dropdown i kāu navbar. Pono nā menus dropdown i kahi mea hoʻopili no ka hoʻonohonoho ʻana, no laila e hoʻohana pono i nā mea ʻokoʻa a pūnana no .nav-itema .nav-linke like me ka mea i hōʻike ʻia ma lalo nei.

<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">Navbar</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarNavDropdown">
    <ul class="navbar-nav">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Features</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Pricing</a>
      </li>
      <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-expanded="false">
          Dropdown link
        </a>
        <div class="dropdown-menu">
          <a class="dropdown-item" href="#">Action</a>
          <a class="dropdown-item" href="#">Another action</a>
          <a class="dropdown-item" href="#">Something else here</a>
        </div>
      </li>
    </ul>
  </div>
</nav>

Nā palapala

E kau i nā ʻano mana like ʻole a me nā ʻāpana i loko o kahi navbar me .form-inline.

<nav class="navbar navbar-light bg-light">
  <form class="form-inline">
    <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
    <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
  </form>
</nav>

E hoʻohana i nā ʻano keiki ponoʻī e .navbarhoʻohana i ka hoʻonohonoho flex a e paʻa i ka justify-content: space-between. E hoʻohana i nā pono hana maʻalahi e like me ka mea e pono ai e hoʻoponopono i kēia ʻano.

<nav class="navbar navbar-light bg-light">
  <a class="navbar-brand">Navbar</a>
  <form class="form-inline">
    <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
    <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
  </form>
</nav>

Hana pū kekahi pūʻulu hoʻokomo:

<nav class="navbar navbar-light bg-light">
  <form class="form-inline">
    <div class="input-group">
      <div class="input-group-prepend">
        <span class="input-group-text" id="basic-addon1">@</span>
      </div>
      <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1">
    </div>
  </form>
</nav>

Kākoʻo ʻia nā pihi like ʻole ma ke ʻano o kēia mau ʻano navbar. He mea hoʻomanaʻo maikaʻi hoʻi kēia e hiki ke hoʻohana ʻia nā pono hana alignment vertical e hoʻohālikelike i nā mea nui like ʻole.

<nav class="navbar navbar-light bg-light">
  <form class="form-inline">
    <button class="btn btn-outline-success" type="button">Main button</button>
    <button class="btn btn-sm btn-outline-secondary" type="button">Smaller button</button>
  </form>
</nav>

kikokikona

Loaʻa paha i nā Navbars nā ʻāpana kikokikona me ke kōkua o .navbar-text. Hoʻoponopono kēia papa i ka hoʻopololei kū pololei a me ka hakahaka ākea no nā kaula kikokikona.

<nav class="navbar navbar-light bg-light">
  <span class="navbar-text">
    Navbar text with an inline element
  </span>
</nav>

Hoʻohui a hoʻohālikelike me nā mea ʻē aʻe a me nā pono hana e like me ka mea e pono ai.

<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">Navbar w/ text</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarText">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Features</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Pricing</a>
      </li>
    </ul>
    <span class="navbar-text">
      Navbar text with an inline element
    </span>
  </div>
</nav>

Nā kala kala

ʻAʻole i maʻalahi ka hana ʻana i ka navbar ma muli o ka hui pū ʻana o nā papa kumuhana a me background-colornā pono hana. E koho mai .navbar-lightno ka hoʻohana ʻana me nā kala ʻulaʻula, a i ʻole .navbar-darkno nā kala ʻeleʻele. A laila, hoʻonohonoho me .bg-*nā pono hana.

<nav class="navbar navbar-dark bg-dark">
  <!-- Navbar content -->
</nav>

<nav class="navbar navbar-dark bg-primary">
  <!-- Navbar content -->
</nav>

<nav class="navbar navbar-light" style="background-color: #e3f2fd;">
  <!-- Navbar content -->
</nav>

Nā pahu pahu

ʻOiai ʻaʻole koi ʻia, hiki iā ʻoe ke kāʻei i kahi navbar i kahi .containerkikowaena ma kahi ʻaoʻao. A i ʻole hiki iā ʻoe ke hoʻohui i kahi pahu i loko o ka mea .navbare hoʻokomo wale i nā ʻike o kahi navbar luna paʻa a paʻa paha .

<div class="container">
  <nav class="navbar navbar-expand-lg navbar-light bg-light">
    <a class="navbar-brand" href="#">Navbar</a>
  </nav>
</div>

Aia ka pahu i loko o kāu navbar, hoʻoneʻe ʻia kona padding ākea ma nā wahi haʻahaʻa ma lalo o kāu .navbar-expand{-sm|-md|-lg|-xl}papa i kuhikuhi ʻia. ʻO kēia ka mea e hōʻoia ʻaʻole mākou e pāpālua i ka hoʻopaʻa ʻana me ka pono ʻole ma nā puka nānā haʻahaʻa ke hāʻule kāu navbar.

<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <div class="container">
    <a class="navbar-brand" href="#">Navbar</a>
  </div>
</nav>

Hoʻokomo

E hoʻohana i kā mākou mau pono kūlana e kau i nā navbars i nā kūlana non-static. E koho mai ka paʻa i luna, hoʻopaʻa ʻia i lalo, a i ʻole i hoʻopaʻa ʻia i luna (e ʻōwili me ka ʻaoʻao a hiki i luna, a laila noho ma laila). Hoʻohana ʻia nā navbars paʻa position: fixed, ʻo ia hoʻi, ua huki ʻia lākou mai ke kahe maʻamau o ka DOM a makemake paha i ka CSS maʻamau (e laʻa, padding-topma ka <body>) e pale i ka uhi ʻana me nā mea ʻē aʻe.

E hoʻomaopopo hoʻi i ka .sticky-tophoʻohana ʻana position: sticky, ʻaʻole i kākoʻo piha ʻia i kēlā me kēia polokalamu kele pūnaewele .

<nav class="navbar navbar-light bg-light">
  <a class="navbar-brand" href="#">Default</a>
</nav>
<nav class="navbar fixed-top navbar-light bg-light">
  <a class="navbar-brand" href="#">Fixed top</a>
</nav>
<nav class="navbar fixed-bottom navbar-light bg-light">
  <a class="navbar-brand" href="#">Fixed bottom</a>
</nav>
<nav class="navbar sticky-top navbar-light bg-light">
  <a class="navbar-brand" href="#">Sticky top</a>
</nav>

Owili

Hoʻohui .navbar-nav-scrolli kahi .navbar-collapse(a i ʻole ʻāpana navbar ʻē aʻe) e hiki ai i ka ʻōwili kū pololei i loko o nā mea hiki ke hoʻololi ʻia o kahi navbar hāʻule. ʻO ka mea paʻamau, hoʻomaka ka ʻōwili ʻana ma 75vh(a i ʻole 75% o ke kiʻekiʻe o ka viewport), akā hiki iā ʻoe ke hoʻopau i kēlā me nā ʻano inline a i ʻole nā ​​​​ʻano maʻamau. Ma nā puka ʻike nui ke hoʻonui ʻia ka navbar, e ʻike ʻia ka ʻike e like me ia ma kahi navbar paʻamau.

E ʻoluʻolu e hele mai kēia ʻano me kahi drawback o overflow—i ka hoʻonohonoho ʻana overflow-y: auto(pono e ʻōwili i ka maʻiʻo ma aneʻi), overflow-xʻo ia ka mea like me auto, e ʻoki i kekahi maʻiʻo ākea.

Eia kekahi laʻana navbar e hoʻohana ana .navbar-nav-scrollme style="max-height: 100px;", me kekahi mau mea pono palena palena ʻē aʻe no ka spacing maikaʻi loa.

<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">Navbar scroll</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarScroll" aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarScroll">
    <ul class="navbar-nav mr-auto my-2 my-lg-0 navbar-nav-scroll" style="max-height: 100px;">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Link</a>
      </li>
      <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-expanded="false">
          Link
        </a>
        <ul class="dropdown-menu">
          <li><a class="dropdown-item" href="#">Action</a></li>
          <li><a class="dropdown-item" href="#">Another action</a></li>
          <li><hr class="dropdown-divider"></li>
          <li><a class="dropdown-item" href="#">Something else here</a></li>
        </ul>
      </li>
      <li class="nav-item">
        <a class="nav-link disabled">Link</a>
      </li>
    </ul>
    <form class="d-flex">
      <input class="form-control mr-2" type="search" placeholder="Search" aria-label="Search">
      <button class="btn btn-outline-success" type="submit">Search</button>
    </form>
  </div>
</nav>

Nā hana pane

Hiki i nā Navbars ke hoʻohana i ka .navbar-toggler, .navbar-collapse, a me .navbar-expand{-sm|-md|-lg|-xl}nā papa e hoʻoholo ai i ka wā e hāʻule ai kā lākou ʻike ma hope o kahi pihi. I ka hui pū ʻana me nā pono hana ʻē aʻe, hiki iā ʻoe ke koho maʻalahi i ka wā e hōʻike ai a hūnā i nā mea kikoʻī.

No nā navbar ʻaʻole e hāʻule, hoʻohui i ka .navbar-expandpapa ma ka navbar. No nā navbar e hāʻule mau ana, mai hoʻohui i kekahi .navbar-expandpapa.

Mea hoʻololi

Hoʻopaʻa ʻia nā mea hoʻololi Navbar ma ke ʻano paʻamau, akā inā e hahai lākou i kahi ʻāpana kaikaina e like me ka .navbar-brand, e hoʻopili ʻia lākou i ka ʻaoʻao ʻākau loa. ʻO ka hoʻohuli ʻana i kāu markup e hoʻohuli i ke kau ʻana o ka toggler. Aia ma lalo nā laʻana o nā ʻano hoʻololi like ʻole.

Me ka .navbar-brandhōʻike ʻole ʻia ma ka wahi haʻi liʻiliʻi loa:

<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarTogglerDemo01">
    <a class="navbar-brand" href="#">Hidden brand</a>
    <ul class="navbar-nav mr-auto mt-2 mt-lg-0">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Link</a>
      </li>
      <li class="nav-item">
        <a class="nav-link disabled">Disabled</a>
      </li>
    </ul>
    <form class="form-inline my-2 my-lg-0">
      <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
    </form>
  </div>
</nav>

Me ka inoa hōʻailona i hōʻike ʻia ma ka hema a me ka toggle ma ka ʻākau:

<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">Navbar</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>

  <div class="collapse navbar-collapse" id="navbarTogglerDemo02">
    <ul class="navbar-nav mr-auto mt-2 mt-lg-0">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Link</a>
      </li>
      <li class="nav-item">
        <a class="nav-link disabled">Disabled</a>
      </li>
    </ul>
    <form class="form-inline my-2 my-lg-0">
      <input class="form-control mr-sm-2" type="search" placeholder="Search">
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
    </form>
  </div>
</nav>

Me ka mea hoʻololi ma ka hema a me ka inoa inoa ma ka ʻākau:

<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo03" aria-controls="navbarTogglerDemo03" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="#">Navbar</a>

  <div class="collapse navbar-collapse" id="navbarTogglerDemo03">
    <ul class="navbar-nav mr-auto mt-2 mt-lg-0">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Link</a>
      </li>
      <li class="nav-item">
        <a class="nav-link disabled">Disabled</a>
      </li>
    </ul>
    <form class="form-inline my-2 my-lg-0">
      <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
    </form>
  </div>
</nav>

Maʻiʻo waho

I kekahi manawa makemake ʻoe e hoʻohana i ka plugin collapse e hoʻomaka i kahi mea pahu no ka ʻike e noho ana ma waho o ka .navbar. No ka mea e hana ana kā mākou plugin i ka ida me ka data-targethoʻohālikelike ʻana, maʻalahi ia hana!

<div class="fixed-top">
  <div class="collapse" id="navbarToggleExternalContent">
    <div class="bg-dark p-4">
      <h5 class="text-white h4">Collapsed content</h5>
      <span class="text-muted">Toggleable via the navbar brand.</span>
    </div>
  </div>
  <nav class="navbar navbar-dark bg-dark">
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
  </nav>
</div>

Ke hana ʻoe i kēia, manaʻo mākou e hoʻokomo i ka JavaScript hou e hoʻoneʻe i ka manaʻo programmatically i ka ipu ke wehe ʻia. A i ʻole, paʻakikī paha nā mea hoʻohana keyboard a me nā mea hoʻohana i nā ʻenehana kōkua i ka ʻimi ʻana i ka ʻike hou i hōʻike ʻia - ʻoiai inā ʻo ka ipu i wehe ʻia ma mua o ka mea hoʻololi i ke ʻano o ka palapala. Manaʻo pū mākou e hōʻoia i ka mea hoʻololi i ke ʻano aria-controls, e kuhikuhi ana i ka idpahu maʻiʻo. Ma ke kumumanaʻo, ʻae kēia i nā mea hoʻohana ʻenehana kōkua e lele pololei mai ka toggler a i ka ipu āna e hoʻomalu ai - akā paʻakikī ke kākoʻo no kēia.