Zisa izinto ze-Bootstrap ebomini-ngoku kunye neeplagi ze-jQuery zesiko ezili-13.
Iiplagi zingabandakanywa ngokwahlukeneyo (nangona ezinye zifuna ukuxhomekeka), okanye zonke ngaxeshanye. Zombini i- bootstrap.js kunye ne- bootstrap.min.js ziqulathe zonke iiplagi ezifakiweyo kwifayile enye.
Ungasebenzisa zonke iiplagi ze-Bootstrap ngaphandle kwe-API yokuphawula ngaphandle kokubhala umgca omnye weJavaScript. Le yi-API yeklasi yokuqala ye-Bootstrap kwaye kufuneka ibe yingqwalasela yakho yokuqala xa usebenzisa iplagi.
Oko kwathiwa, kwezinye iimeko kunokunqweneleka ukucima lo msebenzi. Ngoko ke, sikwabonelela ngokukwazi ukuvala uphawu loyelelwano lwedatha i-API ngokukhulula zonke iziganeko kumzimba wegama elifakwe `'idatha-api'`. Oku kukhangeleka ngolu hlobo:
- $ ( 'umzimba' ). cima ( '.data-api' )
Kungenjalo, ukujolisa iplagin ethile, faka nje igama leplagi njengendawo yegama kunye ne-data-api namespace efana nale:
- $ ( 'umzimba' ). cima ( '.alert.data-api' )
Sikwakholelwa ukuba kufuneka ukwazi ukusebenzisa zonke iiplagi zeBootstrap ngeJavaScript API. Zonke ii-API zikawonke-wonke zinye, iindlela ezibolekwayo, kwaye zibuyisela ingqokelela eyenziwayo.
- $ ( ".btn.danger" ). iqhosha ( "toggle" ). addClass ( "amafutha" )
Zonke iindlela kufuneka zamkele into ekhethiweyo yeenketho, umtya ojolise kwindlela ethile, okanye akukho nto (eqalisa iplagin ngokuziphatha okungagqibekanga):
- $ ( "#myModal" ). imodal () // iqaliswe ngokumiselweyo
- $ ( "#myModal" ). imodal ({ ikhibhodi : bubuxoki }) // iqaliswe ngaphandle kwebhodi yezitshixo
- $ ( "#myModal" ). imodali ( 'bonisa' ) // iqalisa kwaye ibhengeza ibonise ngoko nangoko
I-plugin nganye ikwaveza umakhi wayo ekrwada kwipropati `yoMakhi`: $.fn.popover.Constructor
. Ukuba ungathanda ukufumana umzekelo othile weplagi, yifumane ngokuthe ngqo kwinto: $('[rel=popover]').data('popover')
.
Ngamanye amaxesha kuyimfuneko ukusebenzisa iiplagi ze-Bootstrap kunye nezinye izikhokelo ze-UI. Kwezi meko, ukungqubana kwesithuba segama kunokwenzeka ngamanye amaxesha. Ukuba oku kuyenzeka, .noConflict
ungafowunela iplagin onqwenela ukubuyisela ixabiso layo.
- var bootstrapButton = $ . fn . iqhosha . noConflict () // buyisela i-$.fn.iqhosha kwixabiso ebelibekelwe ngaphambili
- $ . fn . i- bootstrapBtn = iqhosha le- bootstrap // nika i-$().bootstrapBtn umsebenzi we-bootstrap
I-Bootstrap ibonelela ngeziganeko zesiko kwizinto ezininzi ezizodwa ze-plugin. Ngokubanzi, ezi ziza ngendlela engapheliyo kunye neyexesha elidlulileyo - apho i-infinitive (umz. show
) iqaliswa ekuqaleni kwesiganeko, kunye nemo yaso yexesha elidlulileyo ye-participle form (umz. shown
) iqala ekugqityweni kwesenzo.
Zonke iziganeko ezingapheliyo zibonelela ngokusebenza kokuthintelaMiselweyo. Oku kubonelela ukukwazi ukumisa ukuphunyezwa kwesenzo phambi kokuba siqale.
- $ ( '#myModal' ). kwi ( 'bonisa' , umsebenzi ( e ) {
- ukuba (! data ) buyisela e . preventDefault () // iyamisa imodal ekubonisweni
- })
Ngeziphumo ezilula zotshintsho, quka i -bootstrap-transition.js kanye ecaleni kwezinye iifayile ze-JS. Ukuba usebenzisa i compiled (okanye minified) bootstrap.js , akukho mfuneko yokuquka oku-sele kukho.
Imizekelo embalwa ye-plugin yotshintsho:
Iimodyuli zilungelelanisiwe, kodwa zibhetyebhetye, iingxoxo zencoko yababini ezinobuncinci obufunekayo obufunekayo kunye nokungagqibekanga okuhlakaniphile.
Imodali enikezelweyo enesihloko, umzimba, kunye neseti yezenzo kumbhalo osemazantsi.
Umzimba omnye olungileyo…
- <div iklasi = "i-modal hide fade" >
- <div class = "modal-header" >
- < uhlobo lweqhosha = "iqhosha" class = "close" data-dismiss = "modal" aria-hidden = "true" > × </ iqhosha>
- <h3> imodal header </h3>
- </ div>
- <div class = "modal-body" >
- <p> Umzimba omnye olungileyo… </p>
- </ div>
- <div class = "modal-footer" >
- <a href = "#" iklasi = "btn"> Vala </a> _
- <a href = "#" class = "btn btn-primary"> Gcina utshintsho </a>
- </ div>
- </ div>
Guqula imodal usebenzisa iJavaScript ngokucofa iqhosha elingezantsi. Iza kutyibilika phantsi kwaye iphele ukusuka phezulu ephepheni.
- <!-- Iqhosha lokucupha imodal -->
- <a href = "#myModal" role = "iqhosha" iklasi = "btn" data-toggle = "modal"> Qalisa indlela yedemo </a>
- <!-- Modal -->
- <div id = "myModal" class = "modal hide fade" tabindex = "-1" indima = "dialog" aria-labelledby = "myModalLabel" aria- hidden = "true" >
- <div class = "modal-header" >
- < uhlobo lweqhosha = "iqhosha" class = "close" data-dismiss = "modal" aria-hidden = "true" > × </ iqhosha>
- <h3 id = "myModalLabel" > Intloko yeModal </h3>
- </ div>
- <div class = "modal-body" >
- <p> Umzimba omnye olungileyo… </p>
- </ div>
- <div class = "modal-footer" >
- < iklasi yeqhosha = "btn" data-dismiss = "modal" aria-hidden = "true" > Vala </ iqhosha>
- < iklasi yeqhosha = "btn btn-primary" > Gcina utshintsho </ iqhosha>
- </ div>
- </ div>
Vula imodali ngaphandle kokubhala iJavaScript. Cwangcisa data-toggle="modal"
isiqalelo somlawuli, njengeqhosha, kunye ne data-target="#foo"
okanye href="#foo"
ukujolisa kwindlela ethile yokuguqula.
- < uhlobo lweqhosha = "iqhosha" data-toggle = "modal" data-target = "#myModal" > Yandulula indlela </iqhosha>
Fowunela i-modal ene-id myModal
ngomgca omnye weJavaScript:
- $ ( '#myModal' ). imodeli ( iinketho )
Iinketho zinokugqithiswa ngeempawu zedatha okanye iJavaScript. Kuphawu lwedatha, faka igama lokhetho ku data-
, njengakwi data-backdrop=""
.
Igama | uhlobo | ukungagqibeki | inkcazelo |
---|---|---|---|
ngasemva | boolean | yinyani | Ibandakanya i-modal-backdrop element. Kungenjalo, khankanya static imeko yangasemva engayivaliyo imodal ngokucofa. |
ikhibhodi | boolean | yinyani | Ivala imodal xa iqhosha lokubaleka licofa |
bonisa | boolean | yinyani | Ibonisa imodali xa iqaliswa. |
kude | indlela | bubuxoki | Ukuba i-url ekude inikezelwe, umxholo uya kulayishwa ngendlela yejQuery
|
Yenza umxholo wakho ube yimodali. Yamkela iinketho ozikhethelayo object
.
- $ ( '#myModal' ). imodeli ({
- keyboard : bubuxoki
- })
Yenza imodal ngesandla.
- $ ( '#myModal' ). imodali ( 'tshintsha' )
Ivula imodali ngesandla.
- $ ( '#myModal' ). imodali ( 'bonisa' )
Ufihla imodali ngesandla.
- $ ( '#myModal' ). imodali ( 'fihla' )
Iklasi ye-modal ye-Bootstrap iveza iminyhadala embalwa yokuqhagamshelwa ekusebenzeni kwe-modal.
Isiganeko | Inkcazo |
---|---|
bonisa | Esi siganeko sivutha ngokukhawuleza xa show kubizwa indlela yomzekelo. |
ibonisiwe | Esi siganeko sigxothwa xa i-modal yenziwe yabonakala kumsebenzisi (iya kulinda iinguqu ze-css ukuba zigqibe). |
fihla | Esi siganeko sigxothwa ngokukhawuleza xa hide indlela yomzekelo ibiziwe. |
efihliweyo | Esi siganeko siyagxothwa xa imodal igqibile ukufihlwa kumsebenzisi (iya kulinda css iinguqu ukuba igqibe). |
- $ ( '#myModal' ). kwi ( 'ifihliwe' , umsebenzi () {
- // Yenza into…
- })
Yongeza imenyu eyehlayo phantse kuyo yonke into eneplagi elula, kubandakanya i-navbar, iithebhu, kunye neepilisi.
Yongeza data-toggle="dropdown"
kwikhonkco okanye iqhosha ukuguqula ukwehla.
- <div iklasi = "ukwehla" >
- <a iklasi = "dropdown-toggle" data-toggle = "dropdown" href = "#" > Isiqhumiso sokuwisa </a>
- <ul class = "dropdown-menu" role = "imenyu" aria-labelledby = "dLabel" >
- ...
- </ul>
- </ div>
Ukugcina ii-URL zicocekile, sebenzisa data-target
uphawu loyelelwano endaweni ye href="#"
.
- <div iklasi = "ukwehla" >
- <a class = "dropdown-toggle" id = "dLabel" role = "iqhosha" data-toggle = "dropdown" data-target = "#" href = "/page.html" >
- Lahla phantsi
- <b iklasi = "inkathalo" ></b>
- </a>
- <ul class = "dropdown-menu" role = "imenyu" aria-labelledby = "dLabel" >
- ...
- </ul>
- </ div>
Fowunela ukwehla ngeJavaScript:
- $ ( '.ukuhla-ukuguqula' ). ukwehla ()
Akukho nanye
Iprogrammatic api yokuguqula iimenu zebar ye navbar enikiweyo okanye ukukhangela kwe tabbed.
I-plugin yeScrollSpy yeyokuhlaziya ngokuzenzekelayo iithagethi ze-nav ngokusekelwe kwindawo yokuskrola. Skrolela indawo engezantsi kwe-navbar kwaye ubukele utshintsho lweklasi esebenzayo. Imiba esezantsi eyehlayo nayo iya kuphawulwa.
Ad leggings keytar, brunch id art party dolor labore. I-Pitchfork ngonyaka enim lo-fi ngaphambi kokuba bathengise yonke into. Tumblr ifama-to-itheyibhile amalungelo ibhayisekile nantoni na. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Ijezi kaCosby ilomo yejean ezimfutshane, williamsburg hoodie minim qui mhlawumbi awuzange uve ngazo et cardigan trust fund culpa biodiesel wes anderson aesthetic. UNihil une tattoo accsamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
Veniam marfa amadevu ngesityibiliki, adipisicing fugiat velit pitchfork iindevu. Freegan iindevu aliqua cupidatat mcsweeney's vero. Cupidatat ezine loko nisi, ea helvetica nulla carles. I-Tattooed cosby sweater ilori yokutya, i-mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. EBrooklyn adipisicing craft beer vice keytar deserunt.
Occaecat commodo aliqua deelectus. Fap craft beer deserunt skateboard ea. Amalungelo ebhayisekile eLomo adipisicing banh mi, velit ea sunt kwinqanaba elilandelayo locavore ikofu enemvelaphi eyodwa e magna veniam. Ubomi obuphezulu id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, ezinzileyo deelectus 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 isithunywa bag marfa nantoni na ilori yokutya deelectus. Sapiente synth id guessnda. Locavore sed helvetica cliche irony, thundercats mhlawumbi awuzange uve ngazo consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat phambi kokuba bathengise, 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.
Ukongeza ngokulula isimilo sokuskrola kulawulo lwakho lwebar engaphezulu, yongeza data-spy="scroll"
nje kwinto ofuna ukuyihlola (ubukhulu becala lo iyakuba ngumzimba) kwaye data-target=".navbar"
ukhethe ukuba yeyiphi nav oza kuyisebenzisa. Uya kufuna ukusebenzisa iscrollspy kunye .nav
necandelo.
- <body data-spy = "scroll" data-target = ".navbar" > ... </ body>
Fowunela iscrollspy ngeJavaScript:
- $ ( '#navbar' ). skrola ()
<a href="#home">home</a>
kufuneka ihambelane nento ekwidom efana
<div id="home"></div>
.
Xa usebenzisa i-scrollspy ngokudibanisa okanye ukususa izinto kwi-DOM, kuya kufuneka ufowunele indlela yokuhlaziya ngolu hlobo:
- $ ( '[data-spy="scroll"]' ). Nganye ( umsebenzi () {
- var $ hlola = $ ( le ). scrollspy ( 'hlaziya' )
- });
Iinketho zinokugqithiswa ngeempawu zedatha okanye iJavaScript. Kuphawu lwedatha, faka igama lokhetho ku data-
, njengakwi data-offset=""
.
Igama | uhlobo | ukungagqibeki | inkcazelo |
---|---|---|---|
i-offset | inani | 10 | Iipikseli zokulinganisa ukusuka phezulu xa ubala indawo yokuskrola. |
Isiganeko | Inkcazo |
---|---|
vula | Esi siganeko sivutha nanini na into entsha ivuliwe yi-scrollspy. |
Yongeza ngokukhawuleza, ukusebenza kwethebhu eguquguqukayo kwinguqu kwiipaneli zomxholo wasekhaya, nangeemenyu ezihlayo.
Idenim ekrwada mhlawumbi awuzange uve ngabo ibhulukhwe yejean yaseAustin. Nesciunt tofu stumptown aliqua, retro synth master coca. Amadevu cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Ijezi yeCosby eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american iimpahla, 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 before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
Yenza iithebhu ezinokubakho ngeJavaScript (ithebhu nganye kufuneka ivulwe ngokwayo):
- $ ( '#myTab a' ). cofa ( umsebenzi ( e ) {
- e . preventDefault ();
- $ ( oku ). ithebhu ( 'bonisa' );
- })
Unokwenza ithebhu nganye isebenze ngeendlela ezininzi:
- $ ( '#myTab a[href="#profile"]' ). ithebhu ( 'bonisa' ); // Khetha isithuba ngegama
- $ ( '#myTab a:first' ). ithebhu ( 'bonisa' ); // Khetha ithebhu yokuqala
- $ ( '#myTab a:last' ). ithebhu ( 'bonisa' ); // Khetha isithuba sokugqibela
- $ ( '#myTab li:eq(2) a' ). ithebhu ( 'bonisa' ); // Khetha ithebhu yesithathu (0-isalathisi)
Unokwenza ithebhu okanye ukukhangela iipilisi ngaphandle kokubhala nayiphi na iJavaScript ngokuchaza ngokulula data-toggle="tab"
okanye data-toggle="pill"
kwinto. Ukongeza i nav
kunye nav-tabs
neeklasi kwithebhu ul
kuya kusebenzisa isitayile se-Bootstrap tab.
- <ul iklasi = "nav-tabs" >
- <li><a href = "#ikhaya" data-toggle = "tab"> Ekhaya </a> < /li>
- <li><a href = "#profile" data-toggle = "tab"> Inkangeleko yesimo </a></li >
- <li><a href = "# imiyalezo" data-toggle = "tab"> Imiyalezo </a> < /li>
- <li><a href = "#settings" data-toggle = "tab"> Useto </a> </li>
- </ul>
Yenza isiqalelo sethebhu kunye nesiqulatho sisebenze. Isithuba kufuneka sibenendawo data-target
okanye indawo href
yesikhongozeli kwiDOM.
- <ul class = "nav nav-tabs" id = "myTab" >
- <li iklasi = "esebenzayo" > <a href = "#ikhaya"> Ekhaya </a></li>
- <li><a href = "#profile"> Inkangeleko yesimo </a></li>
- <li><a href = "#imiyalezo"> Imiyalezo </a> </li>
- <li><a href = "#iisetingi"> Useto </a> </li>
- </ul>
- <div class = "ithebhu-umxholo" >
- <div class = "i-tab-pane esebenzayo" id = "ikhaya" > ... </div>
- <div class = "i-tab-pane" id = "iprofayile" > ... </div>
- <div class = "i-tab-pane" id = "imiyalezo" > ... </div>
- <div class = "i-tab-pane" id = "iisetingi" > ... </div>
- </ div>
- <script>
- $ ( umsebenzi () {
- $ ( '#myTab a:last' ). ithebhu ( 'bonisa' );
- })
- </script>
Isiganeko | Inkcazo |
---|---|
bonisa | Esi siganeko sivutha kumboniso wethebhu, kodwa ngaphambi kokuba ithebhu entsha iboniswe. Sebenzisa event.target kunye event.relatedTarget nokujolisa isithuba esisebenzayo kunye nesithuba sangaphambili esisebenzayo (ukuba sikhona) ngokulandelelanayo. |
ibonisiwe | Esi siganeko sitshisa kwi-tab show emva kokuba ithebhu ibonisiwe. Sebenzisa event.target kunye event.relatedTarget nokujolisa isithuba esisebenzayo kunye nesithuba sangaphambili esisebenzayo (ukuba sikhona) ngokulandelelanayo. |
- $ ( 'a[data-toggle="tab"]' ). kwi ( 'ibonisiwe' , umsebenzi ( e ) {
- e . ekujoliswe kuko // ithebhu evuliwe
- e . relatedTarget // ithebhu yangaphambili
- })
Ikhuthazwe yeyona plugin igqwesileyo ye-jQuery.tipsy ebhalwe nguJason Frame; Iingcebiso zesixhobo luguqulelo oluhlaziyiweyo, olungathembekanga kwimifanekiso, sebenzisa i-CSS3 yoopopayi, kunye neempawu zedatha zogcino lwesihloko sasekuhlaleni.
Ngezizathu zokusebenza, i-tooltip kunye ne-popover data-apis zingenile, okuthetha ukuba kufuneka uziqalise ngokwakho .
Hambisa ngaphezulu kwezi linki zingezantsi ukuze ubone iingcebiso zesixhobo:
Iibhulukhwe eziqinileyo kwinqanaba elilandelayo keffiyeh mhlawumbi awuzange uve ngazo. Photo booth iindevu ekrwada idenim letterpress vegan messenger bag stumptown. Ifama-to-itheyibhile seitan, i-mcsweeney's fixie ezinzileyo iquinoa ye-8-bit yaseMelika isambatho sine - terry richardson vinyl chambray. Iindevu stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. Igcisa elihlekisayo ngokwenene whatever keytar , i-scenar farm-to-table banksy Austin twitter handle freegan cred krwada idenim enye-origin ikofu viral.
Xa usebenzisa iincam zesixhobo kunye neepopovers ngamaqela egalelo leBootstrap, kuya kufuneka usete i container
(ebhalwe ngezantsi) ukhetho ukuphepha iziphumo ebezingalindelekanga ezingafunekiyo.
Qalisa ingcebiso yesixhobo ngeJavaScript:
- $ ( '#example' ). incam yesixhobo ( iinketho )
Iinketho zinokugqithiswa ngeempawu zedatha okanye iJavaScript. Kuphawu lwedatha, faka igama lokhetho ku data-
, njengakwi data-animation=""
.
Igama | uhlobo | ukungagqibeki | inkcazelo |
---|---|---|---|
oopopayi | boolean | yinyani | sebenzisa i-css fade inguqu kwisixhobo sesixhobo |
html | boolean | bubuxoki | Faka i-html kwincam yesixhobo. Ukuba ayiyonyani, indlela yejquery text izakusetyenziswa ukufaka umxholo kwi dom. Sebenzisa umbhalo ukuba unexhala malunga nohlaselo lwe-XSS. |
ukubekwa | umtya | umsebenzi | 'phezulu' | indlela yokubeka inqaku lesixhobo - phezulu | emazantsi | ekhohlo | kunene |
umkhethi | umtya | bubuxoki | Ukuba umkhethi unikiwe, izixhobo zesixhobo ziya kunikezelwa kwiithagethi ezichaziweyo. |
isihloko | umtya | umsebenzi | '' | ixabiso lesihloko esimiselweyo ukuba `isihloko` ithegi ayikho |
ukuxhokonxa | umtya | 'hover focus' | ivuswa njani ithiphu yesixhobo - cofa | jonga | gxila | incwadi yesandla. Qaphela ukuba ityala lakho ligqithise i-mutliple, indawo eyahluliweyo, iintlobo ze-trigger. |
ukulibazisa | inombolo | into | 0 | ukulibazisa ukubonisa kunye nokufihla incam yesixhobo (ms) - ayisebenzi kudidi lwesiqalisi sesandla Ukuba inani linikiwe, ukulibaziseka kufakwa kuzo zombini ezifihla/umboniso Ulwakhiwo lwento yile: |
isikhongozeli | umtya | bubuxoki | bubuxoki | Ihlomela incam yesixhobo kwinto ethile |
- <a href = "#" data-toggle = "tooltip" title = "tooltip yokuqala"> hambisa phezu kwam </a>
Iqhoboshela isibambi sesixhobo kwingqokelela yesiqalelo.
Ityhila inqaku lesixhobo.
- $ ( '#isiqalelo' ). incam yesixhobo ( 'bonisa' )
Ifihla incam yesixhobo.
- $ ( '#isiqalelo' ). incam yesixhobo ( 'fihla' )
Itshintshela incam yesixhobo.
- $ ( '#isiqalelo' ). incam yesixhobo ( 'toggle' )
Ifihla kwaye itshabalalise isixhobo sesixhobo.
- $ ( '#isiqalelo' ). incam yesixhobo ( 'yonakalisa' )
Yongeza imixholo emincinci, njengaleyo ikwi-iPad, kuyo nayiphi na into yolwazi lwesibini lwezindlu. Hambisa ngaphezulu kweqhosha ukuqalisa ipopover. Ifuna iTip yesixhobo ukuba ibandakanywe.
Zine iinketho ezikhoyo: phezulu, ekunene, ezantsi, nasekhohlo zilungelelanisiwe.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Akukho phawu lubonisayo njenge popovers uveliswa kwiJavaScript kunye nomxholo ngaphakathi data
kophawu.
Vumela iipopovers ngeJavaScript:
- $ ( '#example' ). popover ( iinketho )
Iinketho zinokugqithiswa ngeempawu zedatha okanye iJavaScript. Kuphawu lwedatha, faka igama lokhetho ku data-
, njengakwi data-animation=""
.
Igama | uhlobo | ukungagqibeki | inkcazelo |
---|---|---|---|
oopopayi | boolean | yinyani | sebenzisa i-css fade inguqu kwisixhobo sesixhobo |
html | boolean | bubuxoki | Faka html kwi popover. Ukuba ayiyonyani, indlela yejquery text izakusetyenziswa ukufaka umxholo kwi dom. Sebenzisa umbhalo ukuba unexhala malunga nohlaselo lwe-XSS. |
ukubekwa | umtya | umsebenzi | 'kunene' | indlela yokubeka popover - phezulu | emazantsi | ekhohlo | kunene |
umkhethi | umtya | bubuxoki | ukuba umkhethi unikiwe, izixhobo zesixhobo ziya kunikezelwa kwiithagethi ezichaziweyo |
ukuxhokonxa | umtya | 'cofa' | iqala njani ipopover - cofa | jonga | gxila | incwadi yesandla |
isihloko | umtya | umsebenzi | '' | ixabiso lesihloko esimiselweyo ukuba `isihloko` asikho uphawu loyelelwano |
umxholo | umtya | umsebenzi | '' | ixabiso lesiqulatho esingagqibekanga ukuba `umxholo wedatha` uphawu asikho |
ukulibazisa | inombolo | into | 0 | ukulibazisa ukubonisa kunye nokufihla i-popover (ms) - ayisebenzi kuhlobo lwe-trigger ye-manual Ukuba inani linikiwe, ukulibaziseka kufakwa kuzo zombini ezifihla/umboniso Ulwakhiwo lwento yile: |
isikhongozeli | umtya | bubuxoki | bubuxoki | Ifakela ipopover kwinto ethile |
Ngenxa yezizathu zokusebenza, iSixhobo kunye nePopover data-apis zingenile.
Uqalisa iipopovers zengqokelela yezinto.
Ityhila i-elementi popover.
- $ ( '#isiqalelo' ). popover ( 'bonisa' )
Ifihla i-elements popover.
- $ ( '#isiqalelo' ). popover ( 'fihla' )
Itshintshela izinto popover.
- $ ( '#isiqalelo' ). ipopover ( 'tshintsha' )
Ifihla kwaye itshabalalise i-element's popover.
- $ ( '#isiqalelo' ). ipopover ( 'yonakalisa' )
Yongeza umsebenzi wokugxotha kuyo yonke imiyalezo yesivuseleli ngale plugin.
Guqula le naleya kwaye uzame kwakhona. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.
Vula ukugxothwa kwesivuseleli ngeJavaScript:
- $ ( ".alert" ). lumkisa ()
Yongeza data-dismiss="alert"
nje kwiqhosha lakho lokuvala ukunika ngokuzenzekelayo umsebenzi okufutshane wesilumkiso.
- <a class = "close" data-dismiss = "alert" href = "#" > &amaxesha; </a>
Isonga zonke izilumkiso ngokusebenza ngokusondeleyo. Ukuze izilumkiso zakho ziphile xa zivaliwe, qiniseka ukuba zine .fade
kwaye .in
udidi sele lufakiwe kuzo.
Ivala isilumkiso.
- $ ( ".alert" ). lumkisa ( 'vala' )
Iklasi yesilumkiso ye-Bootstrap iveza iminyhadala embalwa yokuqhagamshelwa ekusebenzeni kwesilumkiso.
Isiganeko | Inkcazo |
---|---|
kufutshane | Esi siganeko sivutha ngokukhawuleza xa close kubizwa indlela yomzekelo. |
ivaliwe | Esi siganeko sigxothwa xa isivuseleli sivaliwe (siya kulinda uguqulo lwe-css lugqibe). |
- $ ( '#isilumkiso sam' ). bopha ( 'ivaliwe' , umsebenzi () {
- // Yenza into…
- })
Fumana izitayile ezisisiseko kunye nenkxaso ebhetyebhetye kumacandelo aqengqelekayo anje ngeaccordion kunye nokuhamba.
* Ifuna iplagin yeTransitions ukuba ibandakanywe.
Sisebenzisa iplagin yokuwa, sakhe iwijethi yesitayile esilula se-accordion:
- <div class = "accordion" id = "accordion2" >
- <div iklasi = "i-accordion-iqela" >
- <div class = "i-accordion-heading" >
- <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseOne"> _
- Into yeQela egotywayo #1
- </a>
- </ div>
- <div id = "collapseOne" class = "accordion-body collapse in" >
- <div iklasi = "i-accordion-yangaphakathi" >
- Imifanekiso eshukumayo...
- </ div>
- </ div>
- </ div>
- <div iklasi = "i-accordion-iqela" >
- <div class = "i-accordion-heading" >
- <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseTwo" >
- Into yeQela egotywayo #2
- </a>
- </ div>
- <div id = "collapseTwo" iklasi = "i-accordion-body collapse" >
- <div iklasi = "i-accordion-yangaphakathi" >
- Imifanekiso eshukumayo...
- </ div>
- </ div>
- </ div>
- </ div>
- ...
Ungasebenzisa kwakhona iplagin ngaphandle kophawu lweaccordion. Yenza iqhosha ukuguqula ukwandisa kunye nokudilika kwenye into.
- < uhlobo lweqhosha = "iqhosha" class = "btn btn-danger" data-toggle = "collapse" data-target = "#demo" >
- elula eqengqelekayo
- </ iqhosha>
- <div id = "idemo" iklasi = "ehla ngaphakathi" > … </div>
Yongeza nje data-toggle="collapse"
kunye ne- data-target
elementi ukunika ngokuzenzekelayo ulawulo lwento eqengqelekayo. Uphawu data-target
loyelelwano lwamkela umkhethi we-css ukuze kufakwe ukutshitshiswa. Qinisekisa ukuba wongeza iklasi collapse
kwinto eqengqelekayo. Ukuba ungathanda ukuba ivuleke ngokungagqibekanga, yongeza udidi olongezelelweyo in
.
Ukongeza ulawulo lweqela olufana ne-accordion kulawulo oluqengqelekayo, yongeza uphawu loyelelwano lwedatha data-parent="#selector"
. Jonga kwidemo ukuze ubone oku kusebenza.
Vula ngesandla nge:
- $ ( ".collapse" ). Ukuwa ()
Iinketho zinokugqithiswa ngeempawu zedatha okanye iJavaScript. Kuphawu lwedatha, faka igama lokhetho ku data-
, njengakwi data-parent=""
.
Igama | uhlobo | ukungagqibeki | inkcazelo |
---|---|---|---|
umzali | umkhethi | bubuxoki | Ukuba umkhethi ke zonke izinto eziqengqelekayo phantsi komzali ochaziweyo ziya kuvalwa xa le nto iqengqelekayo iboniswa. (ifana nokuziphatha kwe-accordion yesiko) |
guqula | boolean | yinyani | Qwalasela into eqengqelekayo kubizo |
Yenza umxholo wakho ube yinto eqengqelekayo. Yamkela iinketho ozikhethelayo object
.
- $ ( '#myCollapsible' ). ukuwa ({
- guqula : bubuxoki
- })
Iguqulela into eqengqelekayo ukuze iboniswe okanye ifihliwe.
Ibonisa into eqengqelekayo.
Ifihla into eqengqelekayo.
Iklasi yokuwa yeBootstrap iveza iminyhadala embalwa yokuhuka ekusebenzeni kokuwa.
Isiganeko | Inkcazo |
---|---|
bonisa | Esi siganeko sivutha ngokukhawuleza xa show kubizwa indlela yomzekelo. |
ibonisiwe | Esi siganeko sigxothwa xa into yokudilika yenziwe yabonakala kumsebenzisi (iya kulinda i-css utshintsho ukuba igqibe). |
fihla | Esi siganeko sigxothwa ngokukhawuleza xa hide indlela sele ibizwa. |
efihliweyo | Esi siganeko siyagxothwa xa into yokudilika ifihliwe kumsebenzisi (iya kulinda uguqulo lwecss ukuba lugqibe). |
- $ ( '#myCollapsible' ). kwi ( 'ifihliwe' , umsebenzi () {
- // Yenza into…
- })
Lo mboniso wesilayidi ungezantsi ubonisa iplagi yegeneric kunye necandelo lokukhwela ibhayisekile kwizinto ezifana necarousel.
- <div id = "myCarousel" iklasi = "icarousel isilayidi" >
- <ol iklasi = "i-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>
- <!-- Izinto zeCarousel -->
- <div iklasi = "i-carousel-yangaphakathi" >
- <div class = "into esebenzayo" > ... </div>
- <div class = "into" > ... </div>
- <div class = "into" > ... </div>
- </ div>
- <!-- Carousel nav -->
- <a class = "carousel-control left" href = "#myCarousel" data-slide = "prev"> &lsaquo ; </a>
- <a class = "right carousel-control" href = "#myCarousel" data-slide = "elandelayo" > › </a>
- </ div>
Sebenzisa iimpawu zedatha ukulawula ngokulula indawo ye-carousel. data-slide
yamkela amagama angundoqo prev
okanye next
, etshintsha indawo yesilayidi ngokunxulumene nendawo yangoku. Kungenjalo, sebenzisa data-slide-to
ukudlulisa isalathiso sesilayidi ekrwada kwicarousel data-slide-to="2"
, etsiba indawo yesilayidi kwisalathiso esithile esiqala nge 0
.
Fowunela i-carousel ngesandla nge:
- $ ( '.carousel' ). Icarousel ()
Iinketho zinokugqithiswa ngeempawu zedatha okanye iJavaScriptz. Kuphawu lwedatha, faka igama lokhetho ku data-
, njengakwi data-interval=""
.
Igama | uhlobo | ukungagqibeki | inkcazelo |
---|---|---|---|
isithuba | inani | 5000 | Ubungakanani bexesha lokulibaziseka phakathi kokubhayisela ngokuzenzekelayo into. Ukuba ayiyonyani, i-carousel ayiyi kujikeleza ngokuzenzekelayo. |
nqumama | umtya | "bhabha" | Misa ukujikeleza kwecarousel kwi-mouseenter kwaye iqalise kwakhona ukukhwela ibhayisekile kwicarousel kwi-mouseleave. |
Uqalisa i-carousel ngeendlela ozikhethelayo object
kwaye uqalise ukukhwela ibhayisekile kwizinto.
- $ ( '.carousel' ). icarousel ({
- Ikhefu : 2000
- })
Ujikeleza izinto zecarousel ukusuka ekhohlo ukuya ekunene.
Imisa ikhareshi ekukhweleni ibhayisekile kwizinto.
Ujikelezisa i-carousel kwisakhelo esithile (i-0 esekelwe, efana noluhlu).
Imijikelo ukuya kwinto yangaphambili.
Biyela ukuya kwinto elandelayo.
Iklasi ye-carousel ye-Bootstrap iveza iminyhadala emibini yokuhuka ekusebenzeni kwecarousel.
Isiganeko | Inkcazo |
---|---|
isilayidi | Esi siganeko sitshatyalaliswa ngoko nangoko xa kusenziwa slide indlela yomzekelo. |
tyibilika | Esi siganeko sigxothwa xa i-carousel igqibile inguqu yayo yesilayidi. |
I-plugin esisiseko, eyandisiweyo ngokulula yokwenza ngokukhawuleza iintloko zokuchwetheza ezintle ngalo naluphi na uhlobo lokufakwa kombhalo.
- <input type = "text" data-provide = "typeahead" >
Uya kufuna ukuseta autocomplete="off"
ukunqanda iimenu zesikhangeli esingagqibekanga ukuba zivele ngaphezulu koluhlu lwe-Bootstrap yokuchwetheza.
Yongeza iimpawu zedatha ukubhalisa into enomsebenzi wokuchwetheza njengoko kubonisiwe kumzekelo ongasentla.
Fowunela i-typeahead ngesandla nge:
- $ ( '.typeahead' ). umphambili wokuchwetheza ()
Iinketho zinokugqithiswa ngeempawu zedatha okanye iJavaScript. Kuphawu lwedatha, faka igama lokhetho ku data-
, njengakwi data-source=""
.
Igama | uhlobo | ukungagqibeki | inkcazelo |
---|---|---|---|
umthombo | uluhlu, umsebenzi | [ ] | Umthombo wedatha yokubuza ngokuchasene. Isenokuba uluhlu lweentambo okanye umsebenzi. Umsebenzi udluliselwe iingxoxo ezimbini, query ixabiso kwindawo yongeniso kunye ne- process callback. Umsebenzi unokusetyenziswa ngongqamaniso ngokubuyisela imvelaphi yedata ngokuthe ngqo okanye process ngokulinganayo ngengxoxo enye ye-callback. |
izinto | inani | 8 | Elona nani liphezulu lezinto eziza kuboniswa kuluhlu. |
minUbude | inani | 1 | Ubuncinane bobude boonobumba obufunekayo phambi kokuqalisa iingcebiso ezizigqibezelelayo |
umenzi | umsebenzi | ityala alinaluvelwano | Indlela esetyenziswayo ukufumanisa ukuba umbuzo uhambelana nento. Yamkela ingxoxo enye, item apho kuvavanywa umbuzo. Fikelela kumbuzo wangoku nge this.query . Buyisela i-boolean true ukuba umbuzo uhambelana. |
umhleli | umsebenzi | ukuhambelana ngqo, uvakalelo lwetyala, ukungakhathali |
Indlela esetyenzisiweyo ukulungisa iziphumo ezizenzekelayo. Yamkela ingxoxo enye items kwaye inomda womzekelo wokuchwetheza. Jonga umbuzo wangoku nge this.query . |
umhlaziyi | umsebenzi | ibuyisela into ekhethiweyo | Indlela esetyenzisiweyo ukubuyisela into ekhethiweyo. Yamkela ingxoxo enye, item kwaye inomda womzekelo wokuchwetheza. |
i-highlighter | umsebenzi | iqaqambisa zonke iimatshisi ezimiselweyo | Indlela esetyenzisiweyo ukugqamisa iziphumo zokugqibezela ngokuzenzekelayo. Yamkela ingxoxo enye item kwaye inomda womzekelo wokuchwetheza. Kufuneka ibuyise i-html. |
Uqalisa igalelo nge-typeahead.
Ukuhanjiswa ngasekhohlo yidemo ephilayo ye-affix plugin.
Ukongeza ngokulula i-affix isimilo kuyo nayiphi na into, yongeza data-spy="affix"
nje kwinto ofuna ukuyihlola. Emva koko sebenzisa ii-offsets ukuchaza ixesha lokutshintshela ukuphina kwento ethile ukuyivula nokuvala.
- <div data-spy = "affix" data-offset-top = "200" > ... </div>
affix
,
affix-top
, kunye
affix-bottom
. Khumbula ukujonga umzali onokuwa xa i-affix ingena njengoko isusa umxholo kwindlela eqhelekileyo yephepha.
Fowunela i-affix plugin usebenzisa iJavaScript:
- $ ( '#navbar' ). ncamathela ()
Iinketho zinokugqithiswa ngeempawu zedatha okanye iJavaScript. Kuphawu lwedatha, faka igama lokhetho ku data-
, njengakwi data-offset-top="200"
.
Igama | uhlobo | ukungagqibeki | inkcazelo |
---|---|---|---|
i-offset | inombolo | umsebenzi | into | 10 | Iipixels zokulinganisa ukusuka kwiscreen xa ubala indawo yokuskrola. Ukuba inani elinye linikiwe, i-offset iya kusetyenziswa kumacala omabini aphezulu nasekhohlo. Ukumamela isalathiso esinye, okanye ii-offsets ezininzi ezahlukeneyo, vele unike into offset: { x: 10 } . Sebenzisa umsebenzi xa ufuna ukubonelela ngokuguquguqukayo kwi-offset (iluncedo kuyilo oluthile oluphendulayo). |