E hoʻolaʻa i nā ʻāpana o Bootstrap—i kēia manawa me 13 mau plugins jQuery maʻamau.
Hiki ke hoʻohui ʻia nā plugins i kēlā me kēia (ʻoiai ua koi ʻia kekahi mau mea hilinaʻi), a i ʻole i ka manawa hoʻokahi. Loaʻa iā bootstrap.js a me bootstrap.min.js nā plugins āpau i hoʻokahi faila.
Hiki iā ʻoe ke hoʻohana i nā plugins Bootstrap āpau ma o ka markup API me ka ʻole o ke kākau ʻana i hoʻokahi laina o JavaScript. ʻO kēia ka API papa mua o Bootstrap a pono ʻoe e noʻonoʻo mua i ka wā e hoʻohana ai i kahi plugin.
ʻO kēlā ʻōlelo, i kekahi mau kūlana makemake paha e hoʻopau i kēia hana. No laila, hāʻawi pū mākou i ka hiki ke hoʻopau i ka API waiwai ʻikepili ma ka wehe ʻana i nā hanana āpau ma ke kino i hoʻopaʻa ʻia me `'data-api'`. Ua like kēia me kēia:
- $ ( 'kino' ). paʻa ( ' .data -api' )
ʻO kahi ʻē aʻe, no ka huli ʻana i kahi plugin kikoʻī, e hoʻopili wale i ka inoa o ka plugin ma ke ʻano he inoa inoa me ka inoa data-api e like me kēia:
- $ ( 'kino' ). pio ( ' .alert.data -api' )
Manaʻo mākou e hiki iā ʻoe ke hoʻohana i nā plugins Bootstrap āpau ma o ka JavaScript API. ʻO nā API lehulehu āpau he ʻano hoʻokahi, hiki ke hoʻopaʻa ʻia, a hoʻihoʻi i ka hōʻiliʻili i hana ʻia.
- $ ( ".btn.danger" ). pihi ( "hoʻololi" ). addClass ( "momona" )
Pono nā ala āpau e ʻae i kahi mea koho koho, kahi kaula e kuhikuhi ana i kahi ala kūikawā, a i ʻole ʻole (e hoʻomaka ana i kahi plugin me ka hana paʻamau):
- $ ( "#myModal" ). modal () // hoʻomaka me nā mea paʻamau
- $ ( "#myModal" ). modal ({ keyboard : false }) // i hoʻomaka me ka ʻole o ka papa keyboard
- $ ( "#myModal" ). modal ( 'hōʻike' ) // hoʻomaka a kāhea koke i ka hōʻike
Hōʻike ʻia kēlā me kēia plugin i kāna mea kūkulu maka ma kahi waiwai `Constructor`: $.fn.popover.Constructor
. Inā makemake ʻoe e kiʻi i kahi laʻana plugin, e kiʻi pololei iā ia mai kahi mea: $('[rel=popover]').data('popover')
.
I kekahi manawa pono e hoʻohana i nā plugins Bootstrap me nā ʻōnaehana UI ʻē aʻe. I kēia mau kūlana, hiki i nā hui hoʻopaʻa inoa ke hiki i kekahi manawa. Inā hiki kēia, hiki iā ʻoe ke kelepona .noConflict
i ka plugin āu e makemake ai e hoʻihoʻi i ka waiwai o.
- var bootstrapButton = $ . fn . pihi . noConflict () // hoʻihoʻi $.fn.button i ka waiwai i hāʻawi mua ʻia
- $ . fn . bootstrapBtn = bootstrapButton // hāʻawi $().bootstrapBtn i ka hana bootstrap
Hāʻawi ʻo Bootstrap i nā hanana maʻamau no ka hapa nui o nā hana kūʻokoʻa o ka plugin. ʻO ka mea maʻamau, hele mai kēia ma kahi ʻano infinitive a me nā mea i hala - kahi i hoʻomaka ai ka infinitive (ex. show
) i ka hoʻomaka ʻana o kahi hanana, a ʻo kona ʻano participle i hala (ex. shown
) ke hoʻomaka i ka pau ʻana o kahi hana.
Hāʻawi nā hanana infinitive āpau i ka hana preventDefault. Hāʻawi kēia i ka hiki ke hoʻopau i ka hoʻokō ʻana i kahi hana ma mua o ka hoʻomaka ʻana.
- $ ( '#myModal' ). ma ( 'hōʻike' , hana ( e ) {
- inā (! ʻikepili ) hoʻihoʻi e . preventDefault () // ho'ōki i ka hōʻike ʻana i ka modal
- })
No nā hopena hoʻololi maʻalahi, e hoʻokomo i ka bootstrap-transition.js me nā faila JS ʻē aʻe. Inā ʻoe e hoʻohana nei i ka bootstrap.js i hōʻuluʻulu ʻia, ʻaʻohe pono e hoʻokomo i kēia—aia ma laila.
ʻO kekahi mau hiʻohiʻona o ka plugin transition:
Hoʻopili ʻia nā modals, akā maʻalahi, nā kamaʻilio me ka liʻiliʻi o ka hana pono a me nā paʻamau akamai.
He ʻano hana i hāʻawi ʻia me ke poʻo, ke kino, a me nā ʻano hana ma ka wāwae.
Hoʻokahi kino maikaʻi…
- <div class = "ʻalo huna kālā" >
- <div class = "modal-header" >
- < ʻano kī = "pāpā" papa = "kokoke" data-dismiss = "modal" aria-huna = "ʻoiaʻiʻo" > & manawa; </ pihi>
- <h3> Ke poʻo kumu </h3>
- </div>
- <div class = "modal-body" >
- <p> Hoʻokahi kino maikaʻi… </p>
- </div>
- <div class = "modal-footer" >
- <a href = "#" class = "btn" > Pani </a>
- <a href = "#" class = "btn btn-primary" > E mālama i nā hoʻololi </a>
- </div>
- </div>
E hoʻololi i kahi modal ma o JavaScript ma ke kaomi ʻana i ke pihi ma lalo. E paheʻe ia i lalo a mae mai ka piko o ka ʻaoʻao.
- <!-- Pākuʻi e hoʻomaka i ke ʻano -->
- <a href = "#myModal" role = "button" class = "btn" data-toggle = "modal" > Hoʻokuʻu i ke ʻano demo </a>
- <!-- Modal -->
- <div id = "myModal" class = "mode huna fade" tabindex = "-1" role = "dialog" aria-labelledby = "myModalLabel" aria-huna = "ʻoiaʻiʻo" >
- <div class = "modal-header" >
- < ʻano kī = "pāpā" papa = "kokoke" data-dismiss = "modal" aria-huna = "ʻoiaʻiʻo" > × </ pihi>
- <h3 id = "myModalLabel" > Poʻomanaʻo kumu </h3>
- </div>
- <div class = "modal-body" >
- <p> Hoʻokahi kino maikaʻi… </p>
- </div>
- <div class = "modal-footer" >
- <button class = "btn" data-dismiss = "modal" aria-hidden = "ʻoiaʻiʻo" > pani </ pihi>
- <button class = "btn btn-primary" > E mālama i nā loli </button>
- </div>
- </div>
E ho'ā i kahi modal me ke kākau ʻole i ka JavaScript. Hoʻonoho ʻia data-toggle="modal"
ma kahi mea hoʻoponopono, e like me ke pihi, me kahi data-target="#foo"
a href="#foo"
i ʻole e kuhikuhi i kahi ʻano kikoʻī e hoʻololi.
- <button type = "button" data-toggle = "modal" data-target = "#myModal" > Launch modal </button>
Kāhea i kahi modal me ka id myModal
me kahi laina o JavaScript:
- $ ( '#myModal' ). modal ( koho )
Hiki ke hāʻawi ʻia nā koho ma o nā ʻikepili a i ʻole JavaScript. No nā ʻano ʻikepili, e hoʻopili i ka inoa koho i data-
, e like me ka data-backdrop=""
.
inoa | ʻano ʻano | paʻamau | wehewehe |
---|---|---|---|
kāʻei kua | boolean | ʻoiaʻiʻo | Loaʻa i kahi ʻāpana modal-backdrop. ʻO kahi ʻē aʻe, e kuhikuhi static i kahi backdrop ʻaʻole i pani i ka modal ma ke kaomi. |
keyboard | boolean | ʻoiaʻiʻo | Pani i ka modal ke kaomi ʻia ke kī pakele |
hōʻike | boolean | ʻoiaʻiʻo | Hōʻike i ka modal i ka wā i hoʻomaka ai. |
mamao | alahele | wahahee | Inā hāʻawi ʻia kahi url mamao, e hoʻouka ʻia ka ʻike ma o ke ʻano o jQuery
|
Ho'ā i kāu ʻike ma ke ʻano he modal. ʻAe i kahi koho koho object
.
- $ ( '#myModal' ). ʻano ({
- keyboard : wahahee
- })
Hoʻololi lima i kahi ʻano.
- $ ( '#myModal' ). modal ( 'hoʻololi' )
Wehe lima ia i kahi modal.
- $ ( '#myModal' ). modal ( 'hōʻike' )
Hūnā lima ʻia kahi ʻano.
- $ ( '#myModal' ). modal ( 'huna' )
Hōʻike ka papa modal Bootstrap i kekahi mau hanana no ka hoʻopili ʻana i ka hana modal.
Hanana | wehewehe |
---|---|
hōʻike | Hoʻomaka koke kēia hanana i ke show kāhea ʻia ʻana o ke ʻano hana. |
hōʻike ʻia | Hoʻopau ʻia kēia hanana i ka wā i ʻike ʻia ai ka modal i ka mea hoʻohana (e kali no ka hoʻopau css e hoʻopau). |
huna | Hoʻopau koke ʻia kēia hanana i ka wā hide i kāhea ʻia ai ke ʻano hana. |
hunaia | Hoʻopau ʻia kēia hanana i ka pau ʻana o ka huna ʻana o ka modal mai ka mea hoʻohana (e kali no ka hoʻololi ʻana o css). |
- $ ( '#myModal' ). ma ( 'huna' , hana () {
- // hana i kekahi mea…
- })
Hoʻohui i nā menus dropdown i nā mea āpau me kēia plugin maʻalahi, me ka navbar, tabs, a me nā huaʻōlelo.
Hoʻohui data-toggle="dropdown"
i kahi loulou a i ʻole pihi e hoʻololi i kahi hāʻule iho.
- <div class = "dropdown" >
- <a class = "dropdown-toggle" data-toggle = "dropdown" href = "#" > Dropdown trigger </a>
- <ul class = "dropdown-menu" role = "menu" aria-labelledby = "dLabel" >
- ...
- </ul>
- </div>
No ka mālama pono ʻana i nā URL, e hoʻohana i ke data-target
ʻano ma kahi o href="#"
.
- <div class = "dropdown" >
- <a class = "dropdown-toggle" id = "dLabel" role = "button" data-toggle = "dropdown" data-target = "#" href = "/page.html" >
- hāʻule iho
- <b class = "caret" ></b>
- </a>
- <ul class = "dropdown-menu" role = "menu" aria-labelledby = "dLabel" >
- ...
- </ul>
- </div>
Kāhea i nā hāʻule iho ma o JavaScript:
- $ ( '.dropdown-toggle' ). hāʻule iho ()
ʻAʻohe
ʻO kahi api papahana no ka hoʻololi ʻana i nā menus no kahi hoʻokele hoʻokele i hāʻawi ʻia.
ʻO ka plugin ScrollSpy no ka hoʻonui ʻokoʻa ʻana i nā pahuhopu nav e pili ana i ke kūlana scroll. E ʻōwili i ka ʻāpana ma lalo o ka navbar a nānā i ka loli o ka papa hana. E hōʻike ʻia nā mea kikoʻī i lalo.
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi ma mua o ko lākou kūʻai ʻana aku. Tumblr farm-to-table bike rights i kēlā me kēia mea. Anim keffiyeh carles cardigan. ʻO ka pahu kiʻi a Velit seitan mcsweeney 3 wolf moon irure. ʻO Cosby sweater lomo jean shorts, williamsburg hoodie minim qui ʻaʻole paha ʻoe i lohe iā lākou a me ka cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork umiumi. ʻO ka ʻumiʻumi Aliqua cupidatat ka vero a mcsweeney. Cupidatat eha loko nisi, ea helvetica nulla carles. Kalaka meaʻai cosby sweater tattooed, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. ʻO Brooklyn adipisicing craft beer vice keytar deserunt.
Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Loaʻa nā kuleana paʻa paikikala ʻo Lomo i hoʻopaʻa ʻia i ka banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. ʻO Vero VHS ka hoʻololi. Consectetur kekahi ʻeke ʻelele liʻiliʻi DIY. Cred ex in, hoʻomau delectus consectetur fanny pack iphone.
In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats ʻaʻole paha ʻoe i lohe no lākou consequat hoodie gluten-free lo-fi fap aliquip. Ma mua o ke kūʻai ʻia ʻana aku, ʻo terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.
No ka hoʻohui maʻalahi i ka hana scrollspy i kāu hoʻokele topbar, e hoʻohui wale data-spy="scroll"
i ka mea āu e makemake ai e mākaʻikaʻi (ʻo ka mea maʻamau ʻo ia ke kino) a data-target=".navbar"
koho i ka nav e hoʻohana ai. Makemake ʻoe e hoʻohana i ka scrollspy me kahi ʻāpana .nav
.
- <body data-spy = "scroll" data-target = ".navbar" > ... </body>
Kāhea i ka scrollspy ma o JavaScript:
- $ ( '#navbar' ). scrollspy ()
<a href="#home">home</a>
pono e pili i kekahi mea i loko o ka dom e like me
<div id="home"></div>
.
Ke hoʻohana nei i ka scrollspy me ka hoʻohui a wehe ʻana paha i nā mea mai ka DOM, pono ʻoe e kāhea i ke ʻano hoʻomaha e like me:
- $ ( '[data-spy="scroll"]' ). kēlā me kēia ( hana () {
- var $spy = $ ( keia ). scrollspy ( 'refresh' )
- });
Hiki ke hāʻawi ʻia nā koho ma o nā ʻikepili a i ʻole JavaScript. No nā ʻano ʻikepili, e hoʻopili i ka inoa koho i data-
, e like me ka data-offset=""
.
inoa | ʻano ʻano | paʻamau | wehewehe |
---|---|---|---|
offset | helu | 10 | Pikika e hoʻoneʻe mai luna mai ke helu ʻana i ke kūlana o ka ʻōwili. |
Hanana | wehewehe |
---|---|
hoʻoikaika | Hoʻomaka kēia hanana i ka wā e hoʻāla ʻia ai kahi mea hou e ka scrollspy. |
E hoʻohui i ka hana papa kuhikuhi wikiwiki a hoʻoikaika i ka hoʻololi ʻana ma nā pane o ka ʻike kūloko, ʻoiai ma o nā menus dropdown.
ʻAʻole paha ʻoe i lohe iā lākou ʻo Jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. ʻO ka ʻūhā 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 ʻaʻahu ʻAmelika, 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.
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi ma mua o ko lākou kūʻai ʻana aku i ka mahiʻai-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. ʻO Wolf salvia freegan, sartorial keffiyeh echo park vegan.
E hoʻā i nā ʻaoʻao papa ma o JavaScript (pono e hoʻāla ʻia kēlā me kēia ʻaoʻao):
- $ ( '#myTab a' ). kaomi ( hana ( e ) {
- e . preventDefault ();
- $ ( keia ). tab ( 'hōʻike' );
- })
Hiki iā ʻoe ke hoʻāla i nā pā pākahi ma nā ʻano he nui:
- $ ( '#myTab a[href="#profile"]' ). tab ( 'hōʻike' ); // E koho i ka papa ma ka inoa
- $ ( '#myTab a:mua' ). tab ( 'hōʻike' ); // E koho i ka papa mua
- $ ( '#myTab a:hope' ). tab ( 'hōʻike' ); // E koho i ka papa hope
- $ ( '#myTab li:eq(2) a' ). tab ( 'hōʻike' ); // Koho i ka papa ʻekolu (0-indexed)
Hiki iā ʻoe ke hoʻoikaika i ka ʻaoʻao a i ʻole ka hoʻokele pila me ka kākau ʻole ʻana i kekahi JavaScript ma ke kuhikuhi wale ʻana a i data-toggle="tab"
ʻole data-toggle="pill"
ma kahi mea. ʻO ka hoʻohui ʻana i nā papa nav
a me nav-tabs
nā papa i ka pā ul
e hoʻopili i ke kāʻei Bootstrap tab.
- <ul class = "nav nav-tabs" >
- <li><a href = "#home" data-toggle = "tab" > Home </a></li>
- <li><a href = "#profile" data-toggle = "tab" > Profile </a></li>
- <li><a href = "#messages" data-toggle = "tab" > Nā memo </a></li>
- <li><a href = "#settings" data-toggle = "tab" > Nā hoʻonohonoho </a></li>
- </ul>
Ho'ā i ka ʻeleʻele tab a me ka ipu maʻiʻo. data-target
Pono e loaʻa i ka Tab href
kahi pahu pahu pahu ma ka DOM.
- <ul class = "nav nav-tabs" id = "myTab" >
- <li class = "active" ><a href = "#home" > Home </a></li>
- <li><a href = "#profile" > Profile </a></li>
- <li><a href = "#messages" > Nā memo </a></li>
- <li><a href = "#settings" > Nā hoʻonohonoho </a></li>
- </ul>
- <div class = "ʻaoʻao-papa" >
- <div class = "tab-pane active" id = "home" > ... </div>
- <div class = "tab-pane" id = "profile" > ... </div>
- <div class = "tab-pane" id = "messages" > ... </div>
- <div class = "tab-pane" id = "nā hoʻonohonoho" > ... </div>
- </div>
- <script>
- $ ( hana () {
- $ ( '#myTab a:hope' ). tab ( 'hōʻike' );
- })
- </script>
Hanana | wehewehe |
---|---|
hōʻike | Hoʻomaka kēia hanana ma ka hōʻike pā, akā ma mua o ka hōʻike ʻia ʻana o ka pā hou. E hoʻohana event.target a event.relatedTarget e hoʻopaʻa i ka pā hana a me ka pā hana mua (inā loaʻa). |
hōʻike ʻia | Hoʻomaka kēia hanana ma ka hōʻike pā ma hope o ka hōʻike ʻia ʻana o kahi pā. E hoʻohana event.target a event.relatedTarget e hoʻopaʻa i ka pā hana a me ka pā hana mua (inā loaʻa). |
- $ ( 'a[data-toggle="tab"]' ). ma ( 'hōʻike' , hana ( e ) {
- e . pahu hopu // i hoʻāla ʻia
- e . relatedTarget // tab mua
- })
Hoʻoulu ʻia e ka plugin jQuery.tipsy maikaʻi loa i kākau ʻia e Jason Frame; He mana hou ʻo Tooltips, ʻaʻole hilinaʻi i nā kiʻi, hoʻohana i ka CSS3 no nā animation, a me nā ʻano ʻikepili no ka mālama ʻana i nā poʻo inoa kūloko.
No nā kumu hana, ua koho ʻia ka tooltip a me ka popover data-apis, ʻo ia hoʻi , pono ʻoe e hoʻomaka iā ʻoe iho .
E kau ma luna o nā loulou ma lalo nei e ʻike i nā ʻōlelo kōkua:
ʻAʻole paha ʻoe i lohe iā lākou. Paʻi kiʻi umiumi maka denim letterpress vegan messenger bag stumptown. Loaʻa iā mcsweeney's fixie sustainable quinoa 8-bit ʻaʻahu ʻAmelika kahi terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, eha loko mcsweeney's cleanse vegan chambray. He kanaka hana hoʻohenehene i kēlā me kēia keytar , scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral.
I ka hoʻohana ʻana i nā hāmeʻa a me nā popovers me nā pūʻulu komo Bootstrap, pono ʻoe e hoʻonohonoho i ke container
koho (i kākau ʻia ma lalo) e pale i nā hopena ʻaoʻao makemake ʻole.
E hoʻomaka i ka mea hana ma o JavaScript:
- $ ( '#example' ). mea kōkua ( koho )
Hiki ke hāʻawi ʻia nā koho ma o nā ʻikepili a i ʻole JavaScript. No nā ʻano ʻikepili, e hoʻopili i ka inoa koho i data-
, e like me ka data-animation=""
.
inoa | ʻano ʻano | paʻamau | wehewehe |
---|---|---|---|
hoʻouluulu | boolean | ʻoiaʻiʻo | e hoʻopili i kahi hoʻololi css fade i ka mea hana |
html | boolean | wahahee | E hoʻokomo i ka html i loko o ka mea hana. Inā he wahaheʻe, e hoʻohana ʻia ke ʻano o jquery text e hoʻokomo i ka ʻike i loko o ka dom. E hoʻohana i ka kikokikona inā hopohopo ʻoe e pili ana i ka hoʻouka kaua XSS. |
hoʻokomo | kaula | hana | 'luna' | pehea e hoʻonoho ai i ka mea hana - top | lalo | waiho | akau |
mea koho | kaulahao | wahahee | Inā hāʻawi ʻia kahi mea koho, e hāʻawi ʻia nā mea hāmeʻa i nā pahuhopu i kuhikuhi ʻia. |
inoa | kaula | hana | '' | ka waiwai poʻo inoa paʻamau inā ʻaʻole i loaʻa ka tag `title` |
hoʻomaka | kaulahao | 'hover focus' | pehea e hoʻoulu ʻia ai ka mea hana - kaomi | e hoolana | makaikai | manual. E hoʻomaopopo iā ʻoe i ka hihia pass trigger mutliple, space seperated, trigger type. |
lohi | helu | mea | 0 | hoʻokaʻulua i ka hōʻike ʻana a hūnā i ka mea hana (ms) - ʻaʻole pili i ke ʻano hoʻoiho manual Inā hāʻawi ʻia kahi helu, hoʻopili ʻia ka lohi i ka huna/hōʻike ʻelua ʻO ka hoʻolālā mea: |
ipu | kaula | wahahee | wahahee | Hoʻopili i ka mea hana i kahi mea kikoʻī |
- <a href = "#" data-toggle = "tooltip" title = "first tooltip" > lele ma luna oʻu </a>
Hoʻopili i kahi mea hoʻohana mea hana i kahi hōʻiliʻili mea.
Hōʻike i ka ʻōlelo kōkua o kahi mea.
- $ ( '#element' ). mea kōkua ( 'hōʻike' )
Hūnā i ka ʻōlelo aʻoaʻo mea paahana.
- $ ( '#element' ). mea kōkua ( 'huna' )
Hoʻololi i ka ʻōlelo kōkua o kekahi mea.
- $ ( '#element' ). mea kōkua ( 'hoʻololi' )
Hūnā a hoʻopau i ka mea paahana o kahi mea.
- $ ( '#element' ). mea hana ( 'hoʻopau' )
Hoʻohui i nā ʻāpana liʻiliʻi o ka ʻike, e like me nā mea ma ka iPad, i kekahi mea no ka ʻike lua hale. E kau ma luna o ke pihi e hoʻomaka i ka popover. Pono e hoʻokomo ʻia i ka Tooltip .
Loaʻa nā koho ʻehā: luna, ʻākau, lalo, a hema.
Hiki ke hoʻopaʻa ʻia ma ka lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Hiki ke hoʻopaʻa ʻia ma ka lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Hiki ke hoʻopaʻa ʻia ma ka lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Hiki ke hoʻopaʻa ʻia ma ka lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
ʻAʻohe māka i hōʻike ʻia ma ke ʻano he popovers i hana ʻia mai JavaScript a me ka ʻike i loko o kahi data
ʻano.
E ho'ā i nā popovers ma o JavaScript:
- $ ( '#example' ). popover ( koho )
Hiki ke hāʻawi ʻia nā koho ma o nā ʻikepili a i ʻole JavaScript. No nā ʻano ʻikepili, e hoʻopili i ka inoa koho i data-
, e like me ka data-animation=""
.
inoa | ʻano ʻano | paʻamau | wehewehe |
---|---|---|---|
hoʻouluulu | boolean | ʻoiaʻiʻo | e hoʻopili i kahi hoʻololi css fade i ka mea hana |
html | boolean | wahahee | E hoʻokomo i ka html i loko o ka popover. Inā he wahaheʻe, e hoʻohana ʻia ke ʻano o jquery text e hoʻokomo i ka ʻike i loko o ka dom. E hoʻohana i ka kikokikona inā hopohopo ʻoe e pili ana i ka hoʻouka kaua XSS. |
hoʻokomo | kaula | hana | 'akau' | pehea e hoʻonoho ai i ka popover - top | lalo | waiho | akau |
mea koho | kaulahao | wahahee | inā hāʻawi ʻia kahi mea koho, e hāʻawi ʻia nā mea hāmeʻa i nā pahuhopu i kuhikuhi ʻia |
hoʻomaka | kaulahao | ' kaomi ' | pehea e hoʻomaka ai ka popover - kaomi | e hoolana | makaikai | manual |
inoa | kaula | hana | '' | ka waiwai poʻo inoa paʻamau inā ʻaʻole i loaʻa ke ʻano `title` |
maʻiʻo | kaula | hana | '' | waiwai maʻiʻo paʻamau inā ʻaʻole i loaʻa ke ʻano `data-content` |
lohi | helu | mea | 0 | hoʻokaʻulua i ka hōʻike ʻana a hūnā i ka popover (ms) - ʻaʻole pili i ke ʻano hoʻoiho manual Inā hāʻawi ʻia kahi helu, hoʻopili ʻia ka lohi i ka huna/hōʻike ʻelua ʻO ka hoʻolālā mea: |
ipu | kaula | wahahee | wahahee | Hoʻopili i ka popover i kahi mea kikoʻī |
No nā kumu hana, ua koho ʻia ka Tooltip a me Popover data-apis.
Hoʻomaka i nā popovers no kahi hōʻiliʻili mea.
Hōʻike i kahi mea popover.
- $ ( '#element' ). popover ( 'hōʻike' )
Hūnā i ka popover element.
- $ ( '#element' ). popover ( 'huna' )
Hoʻololi i ka popover element.
- $ ( '#element' ). popover ( 'hoʻololi' )
Huna a luku i ka popover o kekahi mea.
- $ ( '#element' ). popover ( 'destroy' )
Hoʻohui i nā hana hoʻokuʻu i nā memo makaʻala a pau me kēia plugin.
E hoʻololi i kēia a me kēlā a hoʻāʻo hou. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus noho amet fermentum.
E ʻae i ka wehe ʻana i kahi makaʻala ma o JavaScript:
- $ ( ".alert" ). makaʻala ()
E hoʻohui wale data-dismiss="alert"
i kāu pihi pani e hāʻawi ʻakomi i kahi hana kokoke.
- <a class = "close" data-dismiss = "alert" href = "#" > × </a>
Hoʻopili i nā mākaʻikaʻi āpau me ka hana kokoke. I mea e hoʻolalelale ai kāu mau makaʻala i ka wā i pani ʻia ai, e ʻike pono ua pili ka papa .fade
a me .in
ka papa iā lākou.
Pani i kahi makaʻala.
- $ ( ".alert" ). makaʻala ( 'close' )
Hōʻike ka papa makaʻala o Bootstrap i kekahi mau hanana no ka hoʻopili ʻana i ka hana makaʻala.
Hanana | wehewehe |
---|---|
pili | Hoʻomaka koke kēia hanana i ke close kāhea ʻia ʻana o ke ʻano hana. |
pani ʻia | Hoʻopau ʻia kēia hanana i ka wā i pani ʻia ai ka makaʻala (e kali no ka hoʻololi ʻana o css). |
- $ ( '#my-alert' ). hoʻopaʻa ( 'pani ' , hana () {
- // hana i kekahi mea…
- })
E kiʻi i nā ʻano kumu a me ke kākoʻo maʻalahi no nā mea hiki ke hoʻoheheʻe ʻia e like me nā accordions a me ka hoʻokele.
* Pono e hoʻokomo i ka plugin Transitions.
Ke hoʻohana nei i ka collapse plugin, kūkulu mākou i kahi widget style accordion maʻalahi:
- <div class = "accordion" id = "accordion2" >
- <div class = "accordion-group" >
- <div class = "accordion-heading" >
- <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseOne" >
- ʻImimi hui hiki ke ʻohi ʻia #1
- </a>
- </div>
- <div id = "collapseOne" class = "accordion-body collapse in" >
- <div class = "accordion-inner" >
- Anim pariatur cliche...
- </div>
- </div>
- </div>
- <div class = "accordion-group" >
- <div class = "accordion-heading" >
- <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseTwo" >
- ʻImimi hui hiki ke hoʻopili ʻia #2
- </a>
- </div>
- <div id = "collapseTwo" class = "accordion-body collapse" >
- <div class = "accordion-inner" >
- Anim pariatur cliche...
- </div>
- </div>
- </div>
- </div>
- ...
Hiki iā ʻoe ke hoʻohana i ka plugin me ka ʻole o ka accordion markup. E hana i kahi pihi hoʻololi i ka hoʻonui ʻana a me ka hāʻule ʻana o kekahi mea ʻē aʻe.
- < pihi ʻano kī = "pāpā" papa = "btn btn-pilikia" data- toggle = "hōʻuluʻulu " data-target = "#demo" >
- maʻalahi hiki ke collapsible
- </ pihi>
- <div id = "demo" class = "collapse in" > … </div>
E hoʻohui wale data-toggle="collapse"
a me ka mea data-target
i ka mea e hoʻonoho ʻakomi i ka mana o kahi mea hiki ke collapsible. ʻAe ke data-target
ʻano i kahi koho css e hoʻopili ai i ka hāʻule. E hōʻoia e hoʻohui i ka papa collapse
i ka mea hiki ke collapsible. Inā makemake ʻoe e wehe paʻamau, e hoʻohui i ka papa hou in
.
No ka hoʻohui ʻana i ka hoʻokele hui e like me ka accordion i kahi mana collapsible, e hoʻohui i ke ʻano ʻikepili data-parent="#selector"
. E nānā i ka demo e ʻike i kēia i ka hana.
E ho'ā me ka lima me:
- $ ( ".collapse" ). hāʻule ()
Hiki ke hāʻawi ʻia nā koho ma o nā ʻikepili a i ʻole JavaScript. No nā ʻano ʻikepili, e hoʻopili i ka inoa koho i data-
, e like me ka data-parent=""
.
inoa | ʻano ʻano | paʻamau | wehewehe |
---|---|---|---|
makua | mea koho | wahahee | Inā koho ʻia, e pani ʻia nā mea hiki ke hoʻoheheʻe ʻia ma lalo o ka makua i ʻōlelo ʻia ke hōʻike ʻia kēia mea hiki. (e like me ka hana accordion kuʻuna) |
hoʻololi | boolean | ʻoiaʻiʻo | Hoʻololi i ka mea hiki ke collapsible ma ke kāhea ʻana |
Ho'ā i kāu ʻike ma ke ʻano he mea hiki ke collapsible. ʻAe i kahi koho koho object
.
- $ ( '#myCollapsible' ). hāʻule ({
- hoololi : wahahee
- })
Hoʻololi i kahi mea hiki ke hōʻike ʻia a hūnā ʻia paha.
Hōʻike i kahi mea hiki ke collapsible.
Hūnā i kahi mea hiki ke collapsible.
Hōʻike ka papa hāʻule o Bootstrap i kekahi mau hanana no ka hoʻopili ʻana i ka hana hāʻule.
Hanana | wehewehe |
---|---|
hōʻike | Hoʻomaka koke kēia hanana i ke show kāhea ʻia ʻana o ke ʻano hana. |
hōʻike ʻia | Hoʻopau ʻia kēia hanana i ka wā i ʻike ʻia ai kahi mea hāʻule i ka mea hoʻohana (e kali no ka pau ʻana o nā hoʻololi css). |
huna | Hoʻopau koke ʻia kēia hanana ke hide kāhea ʻia ke ʻano. |
hunaia | Hoʻopau ʻia kēia hanana i ka wā i hūnā ʻia ai kahi mea hāʻule mai ka mea hoʻohana (e kali i ka hoʻololi ʻana o css). |
- $ ( '#myCollapsible' ). ma ( 'huna' , hana () {
- // hana i kekahi mea…
- })
Hōʻike ka kiʻi kiʻiʻoniʻoni ma lalo nei i kahi plugin maʻamau a me kahi mea no ka holo kaʻa i nā mea like me kahi carousel.
- <div id = "myCarousel" class = "carousel slide" >
- <ol class = "carousel-indicators" >
- <li data-target = "#myCarousel" data-slide-to = "0" class = "active" ></li>
- <li data-target = "#myCarousel" data-slide-to = "1" ></li>
- <li data-target = "#myCarousel" data-slide-to = "2" ></li>
- </ol>
- <!-- Nā mea Carousel -->
- <div class = "carousel-inner" >
- <div class = "mea hana" > … </div>
- <div class = "item" > … </div>
- <div class = "item" > … </div>
- </div>
- <!-- Carousel nav -->
- <a class = "carousel-control left" href = "#myCarousel" data-slide = "prev" > ‹ </a>
- <a class = "carousel-control right" href = "#myCarousel" data-slide = "next" > › </a>
- </div>
E hoʻohana i nā hiʻohiʻona ʻikepili e hoʻomalu maʻalahi i ke kūlana o ka carousel. data-slide
ʻae i nā huaʻōlelo a i prev
ʻole next
, e hoʻololi i ke kūlana paheʻe e pili ana i kona kūlana i kēia manawa. ʻO kahi ʻē aʻe, e hoʻohana data-slide-to
i ka hāʻawi ʻana i kahi papa kuhikuhi paheʻe maka i ka carousel data-slide-to="2"
, e lele ana i ke kūlana paheʻe i kahi kuhikuhi kikoʻī e hoʻomaka ana me 0
.
Kāhea lima ʻia ka carousel me:
- $ ( '.carousel' ). carousel ()
Hiki ke hāʻawi ʻia nā koho ma o nā ʻikepili a i ʻole JavaScriptz. No nā ʻano ʻikepili, e hoʻopili i ka inoa koho i data-
, e like me ka data-interval=""
.
inoa | ʻano ʻano | paʻamau | wehewehe |
---|---|---|---|
waena | helu | 5000 | ʻO ka nui o ka manawa e hoʻopaneʻe ai ma waena o ke kaʻa ʻakomi i kahi mea. Inā hoʻopunipuni, ʻaʻole e holo ʻokoʻa ka carousel. |
hoʻomaha | kaulahao | "holo" | Hoʻomaha i ke kaʻa kaʻa o ka carousel ma ka ʻiole komo a hoʻomaka hou i ke kaʻa kaʻa o ka carousel ma ka ʻiole. |
Hoʻomaka ka carousel me nā koho koho object
a hoʻomaka i ka holo kaʻa i nā mea.
- $ ( '.carousel' ). carousel ({
- kaawale : 2000
- })
Kaʻapuni i nā mea carousel mai ka hema a i ka ʻākau.
Hoʻopau i ka carousel mai ka holo paikikala ma nā mea.
Hoʻololi i ka carousel i kahi kiʻi kikoʻī (ma muli o 0, e like me kahi array).
Hoʻoholo i ka mea mua.
Hoʻoholo i ka mea aʻe.
Hōʻike ka papa carousel o Bootstrap i ʻelua hanana no ka hoʻopili ʻana i ka hana carousel.
Hanana | wehewehe |
---|---|
pahee | Hoʻopau koke ʻia kēia hanana i ka wā slide e kāhea ʻia ke ʻano hana. |
pahee | Hoʻopau ʻia kēia hanana ke hoʻopau ka carousel i kāna hoʻololi paheʻe. |
ʻO kahi plugin maʻalahi i hoʻonui ʻia no ka hana wikiwiki ʻana i nā typeaheads nani me nā ʻano kikokikona.
- <input type = "text" data-provide = "typeahead" >
Makemake ʻoe e hoʻonohonoho autocomplete="off"
i ka pale ʻana i nā menus browser paʻamau mai ka ʻike ʻia ʻana ma luna o ka hāʻule ʻana o Bootstrap typeahead.
Hoʻohui i nā hiʻohiʻona ʻikepili e hoʻopaʻa inoa i kahi mea me ka hana typeahead e like me ka hōʻike ʻana ma ka laʻana ma luna.
Kāhea lima ʻia ke poʻo kikokiko me:
- $ ( '.typeahead' ). poʻomanaʻo ()
Hiki ke hāʻawi ʻia nā koho ma o nā ʻikepili a i ʻole JavaScript. No nā ʻano ʻikepili, e hoʻopili i ka inoa koho i data-
, e like me ka data-source=""
.
inoa | ʻano ʻano | paʻamau | wehewehe |
---|---|---|---|
kumu | laha, hana | [ ] | ʻO ke kumu ʻikepili e nīnau ai. He ʻano laina a i ʻole kahi hana. Hoʻoholo ʻia ka hana i ʻelua hoʻopaʻapaʻa, ka query waiwai ma ke kahua hoʻokomo a me ka process callback. Hiki ke hoʻohana like ʻia ka hana ma ka hoʻihoʻi pololei ʻana i ke kumu ʻikepili a i ʻole asynchronously ma o ka process hoʻopaʻapaʻa hoʻokahi o ka callback. |
mau mea | helu | 8 | Ka helu kiʻekiʻe o nā mea e hōʻike ʻia ma ka hāʻule iho. |
minLength | helu | 1 | Pono ka lōʻihi liʻiliʻi ma mua o ka hoʻomaka ʻana i nā manaʻo hoʻopiha piha |
mea hoʻokūkū | hana | hihia ʻole | ʻO ke ala i hoʻohana ʻia e hoʻoholo ai inā pili kekahi nīnau i kahi mea. ʻAe ʻo ia i kahi hoʻopaʻapaʻa hoʻokahi, ʻo item ia ka mea e hoʻāʻo ai i ka nīnau. E komo i ka nīnau o kēia manawa me this.query . E hoʻihoʻi i kahi boolean true inā pili ka nīnau. |
mea hoʻokaʻawale | hana | kūlike pololei, hihia pili, hihia ʻole |
Hoʻohana ʻia no ka hoʻokaʻawale ʻana i nā hopena autocomplete. E ʻae i kahi hoʻopaʻapaʻa hoʻokahi items a loaʻa iā ia ka laulā o ka laʻana typeahead. E kuhikuhi i ka nīnau o kēia manawa me this.query . |
mea hoʻopuka hou | hana | hoʻihoʻi i ka mea i koho ʻia | ʻO ke ala i hoʻohana ʻia e hoʻihoʻi i ka mea i koho ʻia. E ʻae i kahi hoʻopaʻapaʻa hoʻokahi, ʻo ka item a loaʻa ka laulā o ka laʻana typeahead. |
mea hōʻailona | hana | hōʻike i nā pāʻani paʻamau a pau | Hoʻohana ʻia ke ʻano no ka hōʻike ʻana i nā hopena autocomplete. E ʻae i kahi hoʻopaʻapaʻa hoʻokahi item a loaʻa iā ia ka laulā o ka laʻana typeahead. Pono e hoʻihoʻi i ka html. |
Hoʻomaka i kahi hoʻokomo me kahi poʻo kikokiko.
ʻO ka subnavigation ma ka hema he demo ola o ka plugin affix.
No ka hoʻohui maʻalahi i ka hana affix i kekahi mea, e hoʻohui wale data-spy="affix"
i ka mea āu e makemake ai e kiu. A laila e hoʻohana i nā offsets e wehewehe i ka wā e hoʻololi ai i ka paʻi ʻana o kahi mea a i ʻole.
- <div data-spy = "affix" data-offset-top = "200" > ... </div>
affix
,
affix-top
, a
affix-bottom
. E hoʻomanaʻo i ka nānā ʻana i kahi makua hāʻule paha i ka wā e hoʻomaka ai ka affix i kona wehe ʻana i ka ʻike mai ke kahe maʻamau o ka ʻaoʻao.
Kāhea i ka plugin affix ma o JavaScript:
- $ ( '#navbar' ). hoʻopili ()
Hiki ke hāʻawi ʻia nā koho ma o nā ʻikepili a i ʻole JavaScript. No nā ʻano ʻikepili, e hoʻopili i ka inoa koho i data-
, e like me ka data-offset-top="200"
.
inoa | ʻano ʻano | paʻamau | wehewehe |
---|---|---|---|
offset | helu | hana | mea | 10 | E hoʻopau ʻia nā Pixels mai ka pale ke helu ʻana i ke kūlana o ka ʻōwili. Inā hāʻawi ʻia kahi helu hoʻokahi, e hoʻohana ʻia ka offset ma nā ʻaoʻao luna a hema. No ka hoʻolohe ʻana i kahi kuhikuhi hoʻokahi, a i ʻole nā offset kūʻokoʻa he nui, e hāʻawi wale i kahi mea offset: { x: 10 } . E hoʻohana i kahi hana inā pono ʻoe e hāʻawi i kahi offset (pono no kekahi mau hoʻolālā pane). |