Navs ye
Sɛbɛnw ani misaliw baara kɛcogo kan Bootstrap ka navigatiɔn yɔrɔw la minnu bɛ a kɔnɔ.
Base nav
Navigation min bɛ sɔrɔ Bootstrap kɔnɔ, o bɛ taamasiyɛn caman ni cogoyaw tila ɲɔgɔn na, k’a ta basigi .nav
kalasi la ka se active ani disabled states ma. Swap modifier classes ka ɲɔgɔn falen-falen cogoya kelen-kelen bɛɛ cɛ.
Basi .nav
yɔrɔ in bɛ jɔ ni flexbox ye ani ka jusigilan barikama di ka ɲɛsin navigatiɔn yɔrɔ suguya bɛɛ jɔli ma. A bɛ cogoya dɔw 'kɔnɔ (ka baara Kɛ ni lisiw ye), 'jyɛn-yɔrɔ dɔw bɛ yen minnu bɛ Kɛ 'yɔrɔbaw la minnu bɛ 'tàli Kɛ, ani 'sènfɛ-sɛbɛnni basigilenw.
Basi .nav
yɔrɔ in tɛ .active
jamana si la. Misali nataw bɛ kalansen in na, kɛrɛnkɛrɛnnenya la walasa k’a jira ko nin kalan kɛrɛnkɛrɛnnen in tɛ cogoya kɛrɛnkɛrɛnnen si daminɛ.
Kalanso bɛ baara kɛ ni a bɛɛ ye, o la i ka markup bɛ se ka kɛ super flexible ye. Baara kɛ ni <ul>
s ye i n’a fɔ a fɔra cogo min na sanfɛ, <ol>
ni aw ka fɛnw sigicogo nafa ka bon, walima aw bɛ aw yɛrɛ ta wuli ni <nav>
fɛn dɔ ye. Sabula .nav
baarakɛcogo display: flex
, nav jɛgɛnw bɛ taamacogo kelen na i n’a fɔ nav fɛnw bɛna kɛ cogo min na, nka ni taamasiyɛn wɛrɛ tɛ.
Styles minnu bɛ sɔrɔ
s component cogoya Changer .nav
ni modifiers ani utilités ye. Aw bɛ a ɲagami ka a fara ɲɔgɔn kan ni aw mago bɛ a la, walima aw bɛ aw yɛrɛ ta jɔ.
Alignment horizontal (Jɛɲɔgɔnya tilennen).
aw ka nav ka alignment horizontal Changer ni flexbox utilités ye . Ka da a kan, navs bɛ kɛ kinin fɛ, nka i bɛ se k’u Changer nɔgɔya la ka kɛ cɛmancɛ walima kinin fɛ.
Cɛmancɛ la ni .justify-content-center
:
A kinin fɛ ni .justify-content-end
:
Jɔ̀len
Stack i ka navigation ni flex item direction caman cili ye ni .flex-column
utilité ye. Aw mago bɛ u la ka u dalajɛ viewport dɔw kan nka dɔw tɛ wa? Baara kɛ ni jaabiw ye (misali la, .flex-sm-column
).
I n’a fɔ a bɛ Kɛ cogo min na tuma bɛɛ, navigatiɔn jɔlen bɛ Se ka Kɛ ni <ul>
s tɛ, o fana.
Tablow
A bɛ nav basigilen ta ka bɔ san fɛ ka .nav-tabs
kalasi fara a kan walasa ka tabbed interface (dakun) dɔ Lawuli. baara kɛ n' u ye walasa ka tabali maraw dilan ni an ka tablo JavaScript plugin ye .
Furakisɛw
Aw bɛ o HTML kelen in ta, nka aw bɛ baara kɛ n’a .nav-pills
nɔ na:
Fa ani ka jo di a ma
Wajibiya i ka .nav
' kɔnɔkow ka janya dafalen sɔrɔlen bonya kelen la modifier classes fila la. Walasa ka yɔrɔ sɔrɔlenw bɛɛ fa ka kɛɲɛ ni aw ka .nav-item
s ye, aw bɛ baara kɛ ni .nav-fill
. A kɔlɔsi ko yɔrɔ tilennen bɛɛ minɛna, nka nav fɛn bɛɛ bonya tɛ kelen ye.
Ni aw bɛ baara kɛ ni <nav>
-based navigation ye, aw ye aw jija ka a don .nav-item
ankɔriw kan.
Walasa ka fɛnw sɔrɔ minnu bonya bɛ bɛn ɲɔgɔn ma, aw bɛ baara kɛ ni .nav-justified
. Yɔrɔ tilennen bɛɛ bɛna Minɛ nav jɛgɛnsira fɛ, nka a tɛ i n’a fɔ .nav-fill
sanfɛtaw, nav fɛn bɛɛ bɛna Kɛ bonya kelen ye.
I n’a fɔ .nav-fill
misali min bɛ baara kɛ ni <nav>
-based navigation ye, aw ye aw jija ka a don .nav-item
ankɔriw kan.
Baara kɛli ni flex utilities ye
Ni aw mago bɛ jaabi nav caman ɲɔgɔnna caman na, aw bɛ a lajɛ ka baara kɛ ni flexbox nafamafɛnw ye minnu bɛ tugu ɲɔgɔn na . Hali n’a y’a sɔrɔ ko kumasenw ka ca, o nafalanw bɛ ladamuni caman di jaabi-ka-bɔ-yɔrɔw bɛɛ la. Misali min bɛ duguma, an ka nav bɛna Sìgi ɲɔgɔn kan kariyɔrɔ dɔgɔmannin kan, o kɔ fɛ a bɛ Labɛn ka Kɛɲɛ ni labɛncogo tilennen ye min bɛ bonya sɔrɔlen Fa k’a daminɛ kariyɔrɔ fitinin na.
Ka ɲɛsin sɔrɔli ma
N’i bɛ baara Kɛ ni navs ye walasa ka navigatiɔn-yɔrɔ Di, i k’i jija ka a Fàra role="navigation"
parent container kan min bɛ hakili sɔrɔ kosɛbɛ <ul>
, walima ka <nav>
fɛn dɔ siri navigatiɔn bɛɛ la. Aw kana jɔyɔrɔ in fara a <ul>
yɛrɛ kan, bawo o bɛna a bali ka laseli kɛ ko a ye lisi yɛrɛ ye dɛmɛni fɛɛrɛw fɛ.
Aw k’a kɔlɔsi ko navigatɛriw, hali ni u labɛnna yecogo la i n’a fɔ tablo ni .nav-tabs
kalasi, u man kan ka di role="tablist"
, role="tab"
walima ka role="tabpanel"
fɛnw di. Olu bɛ bɛn dɔrɔn tablɛtiw ka ɲɔgɔndanw ma minnu bɛ wuli, i n’a fɔ a ɲɛfɔlen bɛ cogo min na WAI ARIA sɛbɛnnikɛcogo kɔnɔ . Aw ye JavaScript kɛcogo lajɛ tablo-interface dinamikiw kan nin yɔrɔ in na misali la.
Baara kɛ ni fɛnw ye minnu bɛ jigin
menu dɔw fara a kan ni HTML dɔ faralen ye ɲɔgɔn kan ani JavaScript plugin min bɛ jigin .
Tablo minnu bɛ ni fɛnw ye minnu bɛ jigin
Furakisɛw ni furakisɛw
JavaScript kɛcogo
Baara kɛ ni JavaScript plugin tab ye—i k’a don a kelen-kelen na walima ka tɛmɛ bootstrap.js
dosiye lajɛlen fɛ—walasa k’an ka navigatiɔn tabw ni furakisɛw janya walasa ka sigida kɔnɔkow tablɛtiw dilan, hali ni menuw ye minnu bɛ jigin.
N'i bɛ an ka JavaScript jɔ ka bɔ source la, a bɛ wajibiyautil.js
.
Dynamic tabbed interfaces, i n’a fɔ a ɲɛfɔlen bɛ cogo min na WAI ARIA Authoring Practices kɔnɔ, olu bɛ role="tablist"
, role="tab"
, role="tabpanel"
, ani fɛn wɛrɛw de wajibiya aria-
walasa k’u jɔcogo, u baarakɛcogo ani u cogoya lase dɛmɛ fɛɛrɛw baarakɛlaw ma (i n’a fɔ ɛkran kalanbagaw).
A kɔlɔsi ko dynamique tabbed interfaces man kan ka kɛ ni dropdown menus ye, bawo o bɛ na ni baarakɛcogo ni sɔrɔli gɛlɛyaw ye. Baarakɛcogo siratigɛ la, ni tab min bɛ jira sisan, o ka trigger element tɛ Ye joona (i n’a fɔ a bɛ 'fɛn min bɛ 'kɔnɔna na min dagalen dòn) o bɛ Se ka hakilijagabɔ Kɛ. Ka bɔ sɔrɔli siratigɛ la, sisan, fɛɛrɛ hakilitigi si tɛ yen min bɛ se ka nin jɔli sugu in kariti kɛ ka kɛɲɛ ni WAI ARIA misali sariyalen ye, o kɔrɔ ye ko a tɛ se ka kɛ fɛn ye min bɛ se ka faamuya nɔgɔya la dɛmɛnfɛɛrɛw baarakɛlaw fɛ.
Raw denim i bɛ se ka u ma mɛn u jean shorts Austin. Nesciunt tofu stumptown aliqua, retro sinteti master saniya. Moustache cliche tempor, williamsburg carles ka helvetica sogo-minɛ. Reprehenderit butcher retro keffiyeh sugo minɛbaga synth. Cosby sweater eu banh mi, qui irure terry richardson ex calmar. Bamako, Mali. Aliquip placeat ka baara kɛ ni iphone ye. Seitan aliquip quis cardigan ameriki fini, sogo feerela 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.
Walasa ka dɛmɛ don ka bɛn i magow ma, o bɛ baara kɛ ni <ul>
-based markup ye, i n’a fɔ a jiralen bɛ cogo min na sanfɛ, walima ni “roll your own” taamasiyɛn suguya o suguya ye. A kɔlɔsi ko n’i bɛ baara Kɛ ni <nav>
, i man kan ka dɔ Fàra a kan role="tablist"
k’a ɲɛsin a ma, bari o bɛna fɛn in jɔyɔrɔ fɔlɔ Bɔ a la i n’a fɔ navigatiɔn taamaʃyɛn. O nɔ na, aw bɛ wuli ka taa fɛn wɛrɛ la (misali la min bɛ duguma, a nɔgɔn <div>
) ka a <nav>
lamini.
Tabs plugin fana bɛ baara kɛ ni furakisɛw ye.
O kɔsɔn occaecat ullamco amet non eiusmod nostrud dolore irure incididunt est duis anim sunt officia. Fugiat velit proident aliquip nisi incididunt nugu ka farikoloɲɛnajɛ kɛcogo proident est nisi. Irure magna elit commodo anim ex veniam culpa eiusmod id nostrud sigi cupidat la veniam ad. Eiusmod consequat eu adipisicing minim ani aliquip cupidatat culpa excepteur quis. Occaecat sigi eu farikoloɲɛnajɛ 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.
Ani ni furakisɛ jɔlenw ye.
Cillum ad ut irure tempor velit nostrud occaecat ullamco aliqua ani Lorem sint. Veniam sint duis incididunt do esse magna mollit ka bɔ laborum qui. Id id reprehenderit sit est eu aliqua occaecat quis ni velit ka bɔ laborum mollit dolore eiusmod la. Ipsum dolor bɛ occaecat commodo ni voluptate minim reprehenderit mollit pariatur kɔnɔ. 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.
Baara kɛ ni data attributes ye
I bɛ se ka tab walima pill navigation dɔ baara k’a sɔrɔ i ma JavaScript si sɛbɛn ni i ye element dɔ jira dɔrɔn data-toggle="tab"
walima a kan. data-toggle="pill"
Baara kɛ ni nin kunnafonidilanw ye .nav-tabs
walima .nav-pills
.
JavaScript fɛ
Tabable tabw daminɛ JavaScript fɛ (tab kelen-kelen bɛɛ ka kan ka baara kɛ kelen-kelen):
Aw bɛ se ka tablo kelen-kelen bɛɛ baara cogo caman na:
Fade nɔ ye
Walisa ka tablow ka fade in kɛ, i ka dɔ fara .fade
u kelen-kelen bɛɛ .tab-pane
kan . Tablo fɔlɔ fana ka kan .show
ka kɛ sababu ye ka kɔnɔko fɔlɔw kɛ fɛn yetaw ye.
Fɛɛrɛw
Fɛɛrɛ minnu tɛ kelen ye ani fɛn caman tigɛli
API fɛɛrɛw bɛɛ ye asynchrone ye ani ka tɛmɛsira dɔ daminɛ . u bɛ segin welebaga ma ni wuli daminɛna dɔrɔn nka sanni a ka ban . Ka fara o kan, fɛɛrɛ weleli min bɛ kɛ tɛmɛsira yɔrɔ dɔ kan, o bɛna jate .
aw ye an ka JavaScript sɛbɛnw lajɛ walasa ka kunnafoni wɛrɛw sɔrɔ .
$().tab ye
A bɛ tab element ni kɔnɔkow minɛn dɔ baara. Tab ka kan ka kɛ ni a ye data-target
walima ni href
targeting a container node ye DOM kɔnɔ.
.tab(' jira')
A bɛ tab dilen sugandi ani k’a ni ɲɔgɔn cɛ pane jira. Tab wɛrɛ o wɛrɛ min tun sugandira ka tɛmɛ, o bɛ kɛ sugandibali ye ani a ni ɲɔgɔn cɛ panneau bɛ dogo. A bɛ Segin welebaga ma sanni tab pane ka jira tiɲɛ na (o kɔrɔ ye ko sanni ko shown.bs.tab
in ka Kɛ).
.tab('ka fili')
A bɛ element dɔ ka tab tiɲɛ.
Ko minnu kɛra
Ni tab kura jira, ko kɛlenw bɛ tasuma don nin cogo la:
hide.bs.tab
(tab min bɛ baara la sisan)show.bs.tab
(tabu min bɛna jira, o kan)hidden.bs.tab
(tab active tɛmɛnen kan, o nihide.bs.tab
ko kɛlen ta ye kelen ye)shown.bs.tab
(tab min jiralen don sisan, o min bɛ baara kura kɛ, o nishow.bs.tab
ko kɛlen ta ye kelen ye)
Ni tab si tun tɛ baara la kaban, o tuma na hide.bs.tab
ani hidden.bs.tab
ko kɛlenw tɛna ci.
Ko kɛlen suguya | Cogojirali |
---|---|
jira.bs.tab la | Nin ko in bɛ tasuma don tab jirali la, nka sanni tab kura ka jira. Baara kɛ event.target ni ani event.relatedTarget ye walasa ka tablo active ani tab active tɛmɛnen (ni o bɛ sɔrɔ) laɲini. |
jiralen.bs.tab ye | Nin ko in bɛ tasuma don tab jirali la tab jiralen kɔfɛ. Baara kɛ event.target ni ani event.relatedTarget ye walasa ka tablo active ani tab active tɛmɛnen (ni o bɛ sɔrɔ) laɲini. |
dogo.bs.tab ye | O ko in bɛ tasuma Bɔ ni tablo kura dɔ ka kan ka jira (wa o cogo la tab baarakɛta tɛmɛnen ka kan ka dogo). Baara kɛ event.target ni ani event.relatedTarget ye walasa ka tab min bɛ baara la sisan ani tab kura min bɛna kɛ sɔɔni, o laɲini, o cogo kelen na. |
dogolen.bs.tab ye | O ko in bɛ tasuma Bɔ tab kura jiralen kɔ (wa o cogo la tab baarakɛta tɛmɛnen bɛ dogo). Baara kɛ event.target ni ani event.relatedTarget ye walasa ka tab baarakɛta tɛmɛnen ni tab baarakɛta kura laɲini, o cogo kelen na. |