Navs
Zvinyorwa uye mienzaniso yemashandisirwo eBootstrap inosanganisirwa zvinhu zvekufambisa.
Base nav
Kufamba kunowanikwa muBootstrap kugovera general markup uye masitayera, kubva pabase .nav
kirasi kuenda kune anoshanda uye akaremara nyika. Chinjana makirasi ekugadzirisa kuti uchinje pakati pechimwe nechimwe chimiro.
Iyo base .nav
chikamu chakavakwa neflexbox uye inopa hwaro hwakasimba hwekuvaka ese marudzi ezvimedu zvekufambisa. Inosanganisira mamwe maitiro ekupfuura (yekushanda nemazita), mamwe ekubatanidza padding yenzvimbo dzakakura dzakarova, uye manyorerwo akaremara.
The base .nav
component haisanganisi chero .active
nyika. Mienzaniso inotevera inosanganisira kirasi, kunyanya kuratidza kuti iyi kirasi haikonzerese masitaera.
Makirasi anoshandiswa kwese, saka markup yako inogona kuchinjika zvakanyanya. Shandisa <ul>
s senge pamusoro, <ol>
kana kurongeka kwezvinhu zvako kwakakosha, kana kukungurutsa chako <nav>
nechinhu. Nekuti .nav
mashandisiro display: flex
, iyo nav link inoita senge nav zvinhu zvingaite, asi pasina yakawedzera markup.
Zvitaera zviripo
Chinja chimiro che .nav
s chikamu nema modifiers uye zvishandiso. Sanganisa uye sanganisa sezvinodiwa, kana kuvaka yako.
Horizontal alignment
Shandura kurongeka kweiyo nav yako neflexbox utilities . Nekumisikidza, navs dzakamisikidzwa-kuruboshwe, asi unogona kuzvishandura zviri nyore kuti zvive pakati kana kurudyi.
Pakati ne .justify-content-center
:
Yakanangana ne .justify-content-end
:
Vertical
Rongedza kufamba kwako nekushandura flex chinhu kutungamira .flex-column
nekushandisa. Unoda kuaisa pane mamwe maonero asi kwete mamwe? Shandisa shanduro dzinopindura (semuenzaniso, .flex-sm-column
).
Senguva dzose, vertical navigation inogoneka pasina <ul>
s, futi.
Tabs
Inotora iyo yakakosha nav kubva kumusoro uye inowedzera .nav-tabs
kirasi kugadzira tabbed interface. Vashandise kugadzira matunhu anobatika netabhu yedu JavaScript plugin .
Mapiritsi
Tora iyo HTML yakafanana, asi shandisa .nav-pills
pachinzvimbo:
Zadza uye ruramisa
Manikidza .nav
zvirimo kuti uwedzere huzere huripo huzere hwemakirasi maviri ekugadziridza. Kuti uenzane kuzadza nzvimbo yese iripo neako .nav-item
, shandisa .nav-fill
. Ziva kuti nzvimbo yese yakachinjika inogarwa, asi haisi chinhu chese che nav chine hupamhi hwakafanana.
Paunenge uchishandisa <nav>
-based navigation, iva nechokwadi chekuisa .nav-item
pane anchors.
Kuti uwane zvinhu zvakaenzana, shandisa .nav-justified
. Yese nzvimbo yakachinjika ichagarwa ne nav link, asi kusiyana nezviri .nav-fill
pamusoro, chinhu chese che nav chichava nehupamhi hwakafanana.
Zvakafanana .nav-fill
nemuenzaniso uchishandisa <nav>
-based navigation, iva nechokwadi chekuisa .nav-item
pane anchors.
Kushanda neflex utilities
Kana iwe uchida inopindura nav musiyano, funga kushandisa akatevedzana eflexbox utilities . Kunyange zvakanyanya verbose, izvi zvinoshandiswa zvinopa hukuru hukuru pane ese anoteerera anotyora. Mumuenzaniso uri pazasi, nav yedu ichaiswa pane yakaderera breakpoint, yobva yachinjika kune yakachinjika dhizaini inozadza hupamhi huripo kutanga kubva padiki breakpoint.
Nezvekuwanika
Kana uri kushandisa navs kupa bhaa yekufambisa, ive shuwa yekuwedzera role="navigation"
kune ine musoro chigaba chevabereki che <ul>
, kana kuputira <nav>
chinhu kutenderedza kutenderera kwese. Usawedzera basa kune iro <ul>
pacharo, sezvo izvi zvingadzivirira kuti zvisaziviswa sechinyorwa chaicho neanobatsira matekinoroji.
Ziva kuti mabhawa ekufambisa, kunyangwe akanyorwa sematabhu ane .nav-tabs
kirasi, haafanire kupihwa , role="tablist"
kana role="tab"
hunhu role="tabpanel"
. Izvi zvinongokodzera dynamic tabbed interfaces, sekutsanangurwa kwazvinoitwa muWAI ARIA Authoring Practices . Ona maitiro eJavaScript kune anochinja-chinja tabbed interfaces muchikamu chino semuenzaniso.
Kushandisa dropdowns
Wedzera mamenu ekudonhedza nekamwe HTML kadiki uye anodonhedza JavaScript plugin .
Tabs ane dropdowns
Mapiritsi ane dropdowns
JavaScript maitiro
Shandisa iyo tab JavaScript plugin-isanganise iyo yega kana kuburikidza bootstrap.js
nefaira rakanyorwa-kuwedzera ma tabo edu ekufambisa nemapiritsi kugadzira mapaneru anobatika ezvinyorwa zvemuno, kunyangwe nemamenu ekudonha.
Kana iwe uri kuvaka yedu JavaScript kubva kunobva, zvinodautil.js
.
Dynamic tabbed interfaces, sekutsanangurwa kwazvinoitwa muWAI ARIA Authoring Practices , inoda role="tablist"
, role="tab"
, role="tabpanel"
, uye humwe aria-
hunhu kuitira kuti vabudise chimiro chavo, kushanda uye mamiriro azvino kune vashandisi veanobatsira matekinoroji (akadai semascreen readers).
Ziva kuti dynamic tabbed interfaces haifanire kunge iine mamenu ekudonha, sezvo izvi zvichikonzera zvese zvekushandisa uye nyaya dzekuwanikwa. Kubva pamaonero ekushandisa, chokwadi chekuti iyo parizvino inoratidzwa tab's trigger element haisi kuoneka nekukurumidza (sezvo iri mukati meiyo yakavharwa yekudonha menyu) inogona kukonzera nyonganiso. Kubva pakuona kwekusvikika, parizvino hapana nzira ine musoro yekumepu rudzi urwu rwekuvaka kune yakajairwa WAI ARIA patani, zvichireva kuti haigone kunzwisiswa zviri nyore kune vashandisi vetekinoroji inobatsira.
Raw denim pamwe hausati wanzwa nezvavo zvipfupi zvejean Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.
Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.
Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.
Kuti zvikubatsire kukwana zvaunoda, izvi zvinoshanda ne <ul>
--based markup, sezvaratidzwa pamusoro, kana chero nechero "pumburudza yako" markup. Ziva kuti kana uri kushandisa <nav>
, haufanirwe kuwedzera role="tablist"
zvakananga kwairi, sezvo izvi zvingapfuura basa rekutanga rechinhu seyekutenderera. Pane kudaro, chinja kune chimwe chinhu (mumuenzaniso pazasi, nyore <div>
) uye kuputira chakaitenderedza <nav>
.
Iyo tabs plugin inoshandawo nemapiritsi.
Consequat occaecat ullamco amet non eiusmod nostrud dolore irure incididunt est duis anim sunt officia. Fugiat velit proident aliquip nisi incididunt nostrud exercitation proident est nisi. Irure magna elit commodo anim ex veniam culpa eiusmod id nostrud sit cupidatat in veniam ad. Eiusmod consequat eu adipisicing minim anim aliquip cupidatat culpa excepteur quis. Occaecat sit eu exercitation irure Lorem incididunt nostrud.
Ad pariatur nostrud pariatur exercitation ipsum ipsum culpa mollit commodo mollit ex. Aute sunt incididunt amet commodo est sint nisi deserunt pariatur do. Aliquip ex eiusmod voluptate exercitation cillum id incididunt elit sunt. Qui minim sit magna Lorem id et dolore velit Lorem amet exercitation duis deserunt. Anim id labore elit adipisicing ut in id occaecat pariatur ut ullamco ea tempor duis.
Est quis nulla laborum officia ad nisi ex nostrud culpa Lorem excepteur aliquip dolor aliqua irure ex. Nulla ut duis ipsum nisi elit fugiat commodo sunt reprehenderit laborum veniam eu veniam. Eiusmod minim exercitation fugiat irure ex labore incididunt do fugiat commodo aliquip sit id deserunt reprehenderit aliquip nostrud. Amet ex cupidatat excepteur aute veniam incididunt mollit cupidatat esse irure officia elit do ipsum ullamco Lorem. Ullamco ut ad minim do mollit labore ipsum laboris ipsum commodo sunt tempor enim incididunt. Commodo quis sunt dolore aliquip aute tempor irure magna enim minim reprehenderit. Ullamco consectetur culpa veniam sint cillum aliqua incididunt velit ullamco sunt ullamco quis quis commodo voluptate. Mollit nulla nostrud adipisicing aliqua cupidatat aliqua pariatur mollit voluptate voluptate consequat non.
Uye nemapiritsi akatwasuka.
Cillum ad ut irure tempor velit nostrud occaecat ullamco aliqua anim Lorem sint. Veniam sint duis incididunt do esse magna mollit excepteur laborum qui. Id id reprehenderit sit eu aliqua occaecat quis et velit excepteur laborum mollit dolore eiusmod. Ipsum dolor in occaecat commodo et voluptate minim reprehenderit mollit pariatur. Deserunt non laborum enim et cillum eu deserunt excepteur ea incididunt minim occaecat.
Culpa dolor voluptate do laboris laboris irure reprehenderit id incididunt duis pariatur mollit aute magna pariatur consectetur. Eu veniam duis non ut dolor deserunt commodo et minim in quis laboris ipsum velit id veniam. Quis ut consectetur adipisicing officia excepteur non sit. Ut et elit aliquip labore Lorem enim eu. Ullamco mollit occaecat dolore ipsum id officia mollit qui esse anim eiusmod do sint minim consectetur qui.
Fugiat id quis dolor culpa eiusmod anim velit excepteur proident dolor aute qui magna. Ad proident laboris ullamco esse anim Lorem Lorem veniam quis Lorem irure occaecat velit nostrud magna nulla. Velit et et proident Lorem do ea tempor officia dolor. Reprehenderit Lorem aliquip labore est magna commodo est ea veniam consectetur.
Eu dolore ea ullamco dolore Lorem id cupidatat excepteur reprehenderit consectetur elit id dolor proident in cupidatat officia. Voluptate excepteur commodo labore nisi cillum duis aliqua do. Aliqua amet qui mollit consectetur nulla mollit velit aliqua veniam nisi id do Lorem deserunt amet. Culpa ullamco sit adipisicing labore officia magna elit nisi in aute tempor commodo eiusmod.
Kushandisa data hunhu
Unogona kumisikidza tebhu kana piritsi kufamba usinganyore chero JavaScript nekungotsanangura data-toggle="tab"
kana data-toggle="pill"
pane chinhu. Shandisa idzi data maitiro pa .nav-tabs
kana .nav-pills
.
Via JavaScript
Gonesa tabable tabs kuburikidza neJavaScript (tebhu yega yega inoda kuvhurwa yega):
Iwe unogona kumisa ma tabo ega ega munzira dzinoverengeka:
Fade effect
Kuita kuti ma tabo asvike mukati, wedzera .fade
kune imwe neimwe .tab-pane
. Yekutanga tebhu pani inofanirawo .show
kuita kuti zvekutanga zvionekwe.
Nzira
Asynchronous nzira uye shanduko
Yese nzira dzeAPI dzine asynchronous uye dzinotanga shanduko . Vanodzokera kumunhu anenge afona pachangotanga shanduko asi isati yapera . Pamusoro pezvo, kufona kwenzira pachikamu chekuchinja kuchafuratirwa .
$().tab
Inomisikidza chinhu chetabhu uye mudziyo wemukati. Tab inofanirwa kunge iine data-target
kana href
yakanangana nemudziyo node muDOM.
.tab('show')
Inosarudza iyo tabhu yakapihwa uye inoratidza yakabatana pane yayo. Chero imwe tab yakambosarudzwa inova isina kusarudzwa uye pane yakabatana nayo inovanzwa. Inodzokera kumunhu arikufona tebhu isati yanyatsoratidzwa (kureva kuti shown.bs.tab
chiitiko chisati chaitika).
.tab('kurasa')
Inoparadza tebhu yechinhu.
Zviitiko
Kana uchiratidza tebhu nyowani, zviitiko zvinopisa nenzira inotevera:
hide.bs.tab
(pane ikozvino inoshanda tab)show.bs.tab
(paicha-kuratidzwa tab)hidden.bs.tab
(paiyo yapfuura inoshanda tebhu, yakafananahide.bs.tab
neyechiitiko)shown.bs.tab
(paiyo ichangobva-kushanda ichangoratidzwa tab, yakafananashow.bs.tab
neyechiitiko)
Kana pasina tebhu yanga yatoshanda, saka iyo hide.bs.tab
uye hidden.bs.tab
zviitiko hazvizodzingwa.
Chiitiko Type | Tsanangudzo |
---|---|
show.bs.tab | Ichi chiitiko chinopisa pane tab show, asi iyo itsva tebhu isati yaratidzwa. Shandisa event.target uye event.relatedTarget kunanga iyo inoshanda tebhu uye yapfuura inoshanda tebhu (kana iripo) zvichiteerana. |
display.bs.tab | Ichi chiitiko chinopisa pane tab show mushure mekunge tab yaratidzwa. Shandisa event.target uye event.relatedTarget kunanga iyo inoshanda tebhu uye yapfuura inoshanda tebhu (kana iripo) zvichiteerana. |
hide.bs.tab | Ichi chiitiko chinopisa kana tabhu nyowani icharatidzwa (uye nekudaro iyo yapfuura inoshanda tebhu inofanira kuvanzwa). Shandisa event.target uye event.relatedTarget kunanga yazvino inoshanda tebhu uye iyo nyowani-ichaita-inoshanda tebhu, zvichiteerana. |
zvakavanzika.bs.tab | Ichi chiitiko chinopisa mushure mekunge tabhu nyowani yaratidzwa (uye nekudaro iyo yapfuura inoshanda tebhu yakavanzwa). Shandisa event.target uye event.relatedTarget kunanga iyo yapfuura inoshanda tebhu uye iyo itsva inoshanda tebhu, zvichiteerana. |