Yenza izingxenye ze-Bootstrap ziphile—manje enama-plugin e-jQuery ngokwezifiso ayi-13.
Ama-plugin angafakwa ngawodwana (yize amanye edinga ukuncika), noma konke ngesikhathi esisodwa. Kokubili i- bootstrap.js ne- bootstrap.min.js iqukethe wonke ama-plugin efayeleni elilodwa.
Ungasebenzisa wonke ama-plugin e-Bootstrap ngokusebenzisa i-markup API ngaphandle kokubhala umugqa owodwa we-JavaScript. Lena i-API yekilasi lokuqala le-Bootstrap futhi kufanele kube ukucabangela kwakho kokuqala lapho usebenzisa i-plugin.
Sekushiwo lokho, kwezinye izimo kungase kufiseleke ukucisha lokhu kusebenza. Ngakho-ke, siphinde futhi sinikeze amandla okukhubaza i-API yesibaluli sedatha ngokukhulula yonke imicimbi emzimbeni ofakwe ``idatha-api'`. Lokhu kubukeka kanje:
- $ ( 'umzimba' ). icishiwe ( '.data-api' )
Kungenjalo, ukuze uqondise i-plugin ethile, vele ufake igama le-plugin njengendawo yegama kanye ne-namespace yedatha-api kanje:
- $ ( 'umzimba' ). icishiwe ( '.alert.data-api' )
Sikholelwa futhi ukuthi kufanele ukwazi ukusebenzisa wonke ama-plugin e-Bootstrap nge-JavaScript API. Wonke ama-API asesidlangalaleni ayizindlela zodwa, ezisebenzisekayo, futhi abuyisela iqoqo osekwenziwe ngalo.
- $ ( ".btn.danger" ). inkinobho ( "guqula" ). addClass ( "amafutha" )
Zonke izindlela kufanele zamukele into ongakhetha kuyo, iyunithi yezinhlamvu eqondise indlela ethile, noma lutho (okuqalisa i-plugin ngokuziphatha okuzenzakalelayo):
- $ ( "#myModal" ). i -modal () // iqaliswe ngokuzenzakalelayo
- $ ( "#myModal" ). i-modal ({ keyboard : false }) // iqaliswe ngaphandle kwekhibhodi
- $ ( "#myModal" ). i -modal ( 'show' ) // iqalisa futhi icele ibonakale ngokushesha
I-plugin ngayinye iphinda iveze umakhi wayo ongahluziwe esakhiweni `soMakhi`: $.fn.popover.Constructor
. Uma ungathanda ukuthola isibonelo esithile se-plugin, sithole ngokuqondile entweni: $('[rel=popover]').data('popover')
.
Kwesinye isikhathi kuyadingeka ukusebenzisa ama-plugin e-Bootstrap nezinye izinhlaka ze-UI. Kulezi zimo, ukungqubuzana kwendawo yamagama kungenzeka ngezikhathi ezithile. Uma lokhu kwenzeka, ungashayela .noConflict
i-plugin ofisa ukubuyisela inani layo.
- var bootstrapButton = $ . fn . inkinobho . noConflict () // buyisela inkinobho engu-$.fn. enanini elinikezwe ngaphambilini
- $ . fn . i -bootstrapBtn = i -bootstrapButton // nika i-$().bootstrapBtn ukusebenza kwe-bootstrap
I-Bootstrap inikeza imicimbi yangokwezifiso yezenzo eziningi ezihlukile ze-plugin. Ngokuvamile, lezi ziza ngendlela engapheli kanye nenkathi edlule - lapho okungapheli (isib. show
) kuqalwa ekuqaleni komcimbi, futhi isimo saso sokuhlanganyela esidlule (isib. shown
) siyisiqalo lapho kuqedwa isenzo.
Yonke imicimbi engapheli ihlinzeka ngokusebenza kokuvimbelaOkuzenzakalelayo. Lokhu kunikeza ikhono lokumisa ukwenziwa kwesenzo ngaphambi kokuthi siqale.
- $ ( '#MyModal' ). ku ( 'show' , umsebenzi ( e ) {
- uma (! idatha ) ibuyisela e . preventDefault () // imisa i-modal ekubonisweni
- })
Ukuze uthole imiphumela elula yoshintsho, faka i -bootstrap-transition.js kanye eceleni kwamanye amafayela e-JS. Uma usebenzisa i-comiled (noma minified) bootstrap.js , asikho isidingo sokufaka lokhu—sekukhona kakade.
Izibonelo ezimbalwa ze-plugin yoshintsho:
Ama-modal ayahlelwa, kodwa aguquguqukayo, imiyalo yengxoxo enobuncane bokusebenza obudingekayo kanye nokuzenzakalelayo okuhlakaniphile.
I-modal enikeziwe enesihloko, umzimba, nesethi yezenzo kunyaweni.
Umzimba owodwa omuhle…
- <div class = "modal hide fade" >
- <div class = "modal-header" >
- <button type = "button" class = "close" data-dismiss = "modal" aria-hidden = "true" > × </inkinobho>
- <h3> Unhlokweni we-Modal </h3>
- </div>
- <div class = "modal-body" >
- <p> Umzimba owodwa omuhle… </p>
- </div>
- <div class = "modal-footer" >
- <a href = "#" class = "btn"> Vala </a> _
- <a href = "#" class = "btn btn-primary" > Londoloza izinguquko </a>
- </div>
- </div>
Guqula i-modal usebenzisa i-JavaScript ngokuchofoza inkinobho engezansi. Izoshelela phansi bese ifiphala kusukela phezulu kwekhasi.
- <!-- Inkinobho yokuqalisa i-modal -->
- <a href = "#myModal" role = "button" class = "btn" data-toggle = "modal" > Yethula imodeli yedemo </a>
- <!-- Imodeli -->
- <div id = "myModal" class = "modal hide fade" tabindex = "-1" role = "dialog" aria-labelledby = "myModalLabel" aria-hidden = "true" >
- <div class = "modal-header" >
- <button type = "button" class = "close" data-dismiss = "modal" aria-hidden = "true" > × </button>
- <h3 id = "myModalLabel" > Unhlokweni wemodeli </h3>
- </div>
- <div class = "modal-body" >
- <p> Umzimba owodwa omuhle… </p>
- </div>
- <div class = "modal-footer" >
- <button class = "btn" data-dismiss = "modal" aria-hidden = "true" > Vala </button>
- <button class = "btn btn-primary" > Londoloza izinguquko </inkinobho>
- </div>
- </div>
Yenza kusebenze i-modal ngaphandle kokubhala i-JavaScript. Misa data-toggle="modal"
into yesilawuli, njengenkinobho, kanye ne-a data-target="#foo"
noma href="#foo"
ukuze uqondise i-modal ethile ukuze uyiguqule.
- <button type = "button" data-toggle = "modal" data-target = "#myModal" > Imodi yokwethula </button>
Shayela i-modal ene-id myModal
enomugqa owodwa we-JavaScript:
- $ ( '#MyModal' ). imodeli ( izinketho )
Izinketho zingadluliswa ngezibaluli zedatha noma i-JavaScript. Ukuze uthole izibaluli zedatha, faka igama lenketho kokuthi data-
, njengaku data-backdrop=""
.
Igama | uhlobo | okuzenzakalelayo | incazelo |
---|---|---|---|
okwasemuva | boolean | iqiniso | Ifaka i-elementi ye-modal-backdrop. Noma, cacisa static okwasemuva okungavali i-modal lapho uchofozwa. |
ikhibhodi | boolean | iqiniso | Ivala i-modal lapho ukhiye we-escape ucindezelwa |
umbukiso | boolean | iqiniso | Ibonisa i-modal lapho iqaliswa. |
kude | indlela | amanga | Uma i-url ekude inikeziwe, okuqukethwe kuzolayishwa ngendlela ye-jQuery
|
Yenza okuqukethwe kwakho kusebenze njengemodeli. Yamukela izinketho ozikhethela object
.
- $ ( '#MyModal' ). imodeli ({
- ikhibhodi : amanga
- })
Iguqula ngokwenza i-modal.
- $ ( '#MyModal' ). i-modal ( 'guqula' )
Ivula mathupha i-modal.
- $ ( '#MyModal' ). imodeli ( 'show' )
Ifihla i-modal ngokwenza.
- $ ( '#MyModal' ). i-modal ( 'fihla' )
Ikilasi le-modal ye-Bootstrap lidalula imicimbi embalwa ukuze ixhume ekusebenzeni kwe-modal.
Umcimbi | Incazelo |
---|---|
umbukiso | Lo mcimbi uvutha ngokushesha lapho show indlela yesibonelo ibizwa. |
kubonisiwe | Lo mcimbi uxoshwa lapho i-modal yenziwe yabonakala kumsebenzisi (izolinda ukuthi izinguquko ze-css ziqedele). |
fihla | Lo mcimbi uxoshwa ngokushesha lapho hide indlela yesibonelo ibizwa. |
kufihliwe | Lo mcimbi uxoshwa lapho i-modal isiqedile ukufihlwa kumsebenzisi (izolinda ukuthi izinguquko ze-css ziqedele). |
- $ ( '#MyModal' ). ku ( 'kufihliwe' , umsebenzi () {
- // enza into…
- })
Engeza amamenyu okwehlayo cishe kunoma yini enale plugin elula, okuhlanganisa i-navbar, amathebhu, namaphilisi.
Engeza data-toggle="dropdown"
kusixhumanisi noma inkinobho ukuze uguqule okwehliswayo.
- <div class = "okwehlayo" >
- <a class = "dropdown-toggle" data-toggle = "dropdown" href = "#" > Inhlamvu yokudonsela phansi </a>
- <ul class = "dropdown-menu" role = "imenyu" aria-labelledby = "dLabel" >
- ...
- </ul>
- </div>
Ukuze ugcine ama-URL eqinile, sebenzisa data-target
isibaluli esikhundleni se- href="#"
.
- <div class = "okwehlayo" >
- <a class = "dropdown-toggle" id = "dLabel" role = "button" data-toggle = "dropdown" data-target = "#" href = "/page.html" >
- Okwehlayo
- <b class = "caret" ></b>
- </a>
- <ul class = "dropdown-menu" role = "imenyu" aria-labelledby = "dLabel" >
- ...
- </ul>
- </div>
Shayela okwehliswayo nge-JavaScript:
- $ ( '.ukuguqula-okwehlayo' ). okwehlayo ()
Lutho
I-programmatic api yokuguqula amamenyu kubha ye-navbar noma ukuzulazula okunethebhu.
I-plugin ye-ScrollSpy ingeyokuvuselela ngokuzenzakalelayo okuhlosiwe kwe-nav ngokusekelwe endaweni yokuskrola. Skrola indawo engezansi kwe-navbar bese ubuka ukuguquka kwekilasi elisebenzayo. Izinto ezincanyana zokwehla zizogqanyiswa nazo.
I-Ad leggings keytar, i-brunch id art party dolor labore. I-Pitchfork ineminyaka engu-nim lo-fi ngaphambi kokuthi bathengise yonke into. Amalungelo ebhayisikili e-Tumblr epulazini ukuya etafuleni noma yini. I-Cardigan ene-anim keffiyeh carles. Indlwana yezithombe ka-Velit seitan mcsweeney 3 wolf moon irure. Ijezi le-Cosby lomo jean shorts, i-williamsburg hoodie minim qui cishe awukaze uzwe ngazo et cardigan trust fund culpa biodiesel wes anderson aesthetic. U-Nihil one-tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
Veniam marfa amadevu skateboard, adipisicing fugiat velit pitchfork intshebe. Freegan intshebe aliqua cupidatat mcsweeney's vero. Cupidatat ezine loko nisi, ea helvetica nulla carles. Iloli lokudla elifakwe ijezi le-cosby, i-mcsweeney's quis non freegan vinyl. I-Lo-fi wes anderson +1 sartorial. I-Carles non-aesthetic exercitation quis gentrify. I-Brooklyn adipisicing craft beer vice keytar deserunt.
I-Occaecat commodo aliqua deelectus. I-Fap craft beer deserunt skateboard ea. Amalungelo ebhayisikili e-Lomo adipisicing banh mi, velit ea sunt next level locavore ikhofi yemvelaphi eyodwa e-magna veniam. I-vinyl id yempilo ephezulu, i-echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. I-Cred ex in, i-iphone eqhubekayo deelectus consectetur fanny pack.
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 deelectus food truck. Sapiente synth id imaginenda. I-Locavore sed helvetica cliche irony, ama-thundercats cishe awukaze uzwe ngawo consequat hoodie gluten-free lo-fi fap aliquip. I-Labore elit placeat ngaphambi kokuba ithengiswe, u-terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. I-Cardigan craft beer seitan readymade velit. I-VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.
Ukwengeza kalula ukuziphatha kwe-scrollspy ekuzulazuleni kwe data-spy="scroll"
-topbar yakho, vele ungeze entweni ofuna ukuyihlola (imvamisa lokhu kuzoba umzimba) data-target=".navbar"
nokukhetha ukuthi iyiphi i-nav ongayisebenzisa. Uzofuna ukusebenzisa i-scrollspy nengxenye .nav
.
- <body data-spy = "scroll" data-target = ".navbar" > ... </body>
Shayela i-scrollspy nge-JavaScript:
- $ ( '#navbar' ). scrollspy ()
<a href="#home">home</a>
must ihambisane nento ethile edomini efana
<div id="home"></div>
.
Uma usebenzisa i-scrollspy ngokuhambisana nokwengeza noma ukususa izakhi ku-DOM, uzodinga ukushayela indlela yokuvuselela kanje:
- $ ( '[data-spy="scroll"]' ). ngakunye ( umsebenzi () {
- var $spy = $ ( lokhu ). scrollspy ( 'refresh' )
- });
Izinketho zingadluliswa ngezibaluli zedatha noma i-JavaScript. Ukuze uthole izibaluli zedatha, faka igama lenketho kokuthi data-
, njengaku data-offset=""
.
Igama | uhlobo | okuzenzakalelayo | incazelo |
---|---|---|---|
offset | inombolo | 10 | Amaphikseli okufanele uwasuse ukusuka phezulu uma ubala indawo yokuskrola. |
Umcimbi | Incazelo |
---|---|
vula | Lo mcimbi uvutha noma nini lapho into entsha yenziwa isebenze i-scrollspy. |
Engeza ukusebenza kwethebhu esheshayo, eguqukayo ukuze udlule kumafasitelana wokuqukethwe kwasendaweni, ngisho namamenyu okwehlayo.
I-denim eluhlaza cishe awuzange uzwe ngabo izikhindi ze-jean Austin. I-Nesciunt tofu stumptown aliqua, i-retro synth master cleanse. Amadevu cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Ijezi le-Cosby 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.
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party ngaphambi kokuba badayise i-master cleanse gluten-free squid scenester freegan cosby sweater. I-Fanny pack portland seitan DIY, i-art party locavore wolf cliche high life echo park Austin. I-Cred vinyl keffiyeh DIY salvia PBR, banh mi ngaphambi kokuthi bathengise i-VHS viral locavore cosby sweater. I-Lomo wolf viral, amadevu alungile enziwe ama-thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
Nika amandla amathebhu aphathekayo nge-JavaScript (ithebhu ngayinye idinga ukwenziwa isebenze ngayodwana):
- $ ( '#myTab a' ). chofoza ( umsebenzi ( e ) {
- e . vimbelaOkuzenzakalelayo ();
- $ ( lokhu ). ithebhu ( 'show' );
- })
Ungavula amathebhu ngamanye ngezindlela ezimbalwa:
- $ ( '#myTab a[href="#profile"]' ). ithebhu ( 'show' ); // Khetha ithebhu ngegama
- $ ( '#myTab a:first' ). ithebhu ( 'show' ); // Khetha ithebhu yokuqala
- $ ( '#myTab a:last' ). ithebhu ( 'show' ); // Khetha ithebhu yokugcina
- $ ( '#myTab li:eq(2) a' ). ithebhu ( 'show' ); // Khetha ithebhu yesithathu (0-inkomba)
Ungakwazi ukuvula ithebhu noma ukuzulazula kwephilisi ngaphandle kokubhala noma iyiphi i-JavaScript ngokucacisa data-toggle="tab"
noma ngento data-toggle="pill"
ethile. Ukwengeza i- nav
kanye nav-tabs
namakilasi kuthebhu ul
kuzosebenzisa isitayela sethebhu ye-Bootstrap.
- <ul class = "nav-tabs" >
- <li><a href = "#home" data-toggle = "tab"> Ikhaya </a></li >
- <li><a href = "#profile" data-toggle = "tab"> Iphrofayili </a></li >
- <li><a href = "#messages" data-toggle = "tab"> Imilayezo </a></li >
- <li><a href = "#settings" data-toggle = "tab"> Izilungiselelo </a></li >
- </ul>
Yenza i-elementi yethebhu isebenze nesiqukathi sokuqukethwe. Ithebhu kufanele ibe no-a data-target
noma i href
-container node ku-DOM.
- <ul class = "nav nav-tabs" id = "myTab" >
- <li class = "active" ><a href = "#home"> Ikhaya </a></li >
- <li > <a href = "#iphrofayili"> Iphrofayili </a></li>
- <li><a href = "#imiyalezo" > Imilayezo </a></li>
- <li > <a href = "#settings"> Izilungiselelo </a></li>
- </ul>
- <div class = "ithebhu-okuqukethwe" >
- <div class = "i-tab-pane esebenzayo" id = "ikhaya" > ... </div>
- <div class = "tab-pane" id = "profile" > ... </div>
- <div class = "tab-pane" id = "imiyalezo" > ... </div>
- <div class = "tab-pane" id = "izilungiselelo" > ... </div>
- </div>
- <script>
- $ ( umsebenzi () {
- $ ( '#myTab a:last' ). ithebhu ( 'show' );
- })
- </script>
Umcimbi | Incazelo |
---|---|
umbukiso | Lo mcimbi uvutha embukisweni wethebhu, kodwa ngaphambi kokuthi kuboniswe ithebhu entsha. Sebenzisa event.target futhi event.relatedTarget uqondise ithebhu esebenzayo kanye nethebhu esebenzayo yangaphambilini (uma ikhona) ngokulandelanayo. |
kubonisiwe | Lo mcimbi uvutha embukisweni wethebhu ngemva kokuthi ithebhu isibonisiwe. Sebenzisa event.target futhi event.relatedTarget uqondise ithebhu esebenzayo kanye nethebhu esebenzayo yangaphambilini (uma ikhona) ngokulandelanayo. |
- $ ( 'a[data-toggle="tab"]' ). ku ( 'kubonisiwe' , umsebenzi ( e ) {
- e . target // ithebhu evuliwe
- e . relatedTarget // ithebhu yangaphambilini
- })
Igqugquzelwe i-plugin enhle kakhulu ye-jQuery.tipsy ebhalwe ngu-Jason Frame; Amathuluzi ayinguqulo ebuyekeziwe, engancikile ezithombeni, sebenzisa i-CSS3 ukuze uthole ukugqwayiza, kanye nezibaluli zedatha zokulondoloza isihloko sendawo.
Ngenxa yezizathu zokusebenza, ithiphu yamathuluzi kanye ne-popover data-apis zingena, okusho ukuthi kufanele uziqalise ngokwakho .
Hambisa phezulu kwezixhumanisi ezingezansi ukuze ubone amathuluzi:
Amabhulukwe aqinile ezingeni elilandelayo keffiyeh cishe awuzwanga ngawo. Photo booth intshebe eluhlaza yedenim letterpress vegan messenger bag stumptown. Isambatho se-farm-to-table seitan, i-mcsweeney's fixie sustainable quinoa 8-bit american apparel ine- terry richardson vinyl chambray. Izintshebe stumptown, cardigans banh mi lomo thundercats. I-Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. Ingcweti ehlekisayo ngempela whatever keytar , i-movie-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral.
Uma usebenzisa amathiphu wamathuluzi nama-popover ngamaqembu okufaka we-Bootstrap, kuzodingeka ukuthi usethe container
inketho (ebhalwe ngezansi) ukuze ugweme imiphumela emibi engadingeki.
Qalisa ithiphu yamathuluzi nge-JavaScript:
- $ ( '#isibonelo' ). ithiphu ( izinketho )
Izinketho zingadluliswa ngezibaluli zedatha noma i-JavaScript. Ukuze uthole izibaluli zedatha, faka igama lenketho kokuthi data-
, njengaku data-animation=""
.
Igama | uhlobo | okuzenzakalelayo | incazelo |
---|---|---|---|
izithombe | boolean | iqiniso | sebenzisa inguquko ye-css fade ethiphu yamathuluzi |
html | boolean | amanga | Faka i-html ethiphu yamathuluzi. Uma kungamanga, indlela ye-jquery text izosetshenziswa ukufaka okuqukethwe ku-dom. Sebenzisa umbhalo uma ukhathazekile ngokuhlaselwa kwe-XSS. |
ukubekwa | umucu | umsebenzi | 'phezulu' | indlela yokubeka ithiphu yamathuluzi - phezulu | phansi | kwesokunxele | kwesokudla |
isikhethi | umucu | amanga | Uma kunikezwa isikhethi, izinto zethiphu yamathuluzi zizodluliselwa kulokho okuhlosiwe okucacisiwe. |
isihloko | umucu | umsebenzi | '' | inani lesihloko elizenzakalelayo uma umaka `wesihloko` ungekho |
inhlamvu | umucu | 'hover focus' | ukuthi ithiphu yamathuluzi icushwa kanjani - chofoza | hamba | gxila | imanuwali. Qaphela ukuthi i-case pass trigger mutliple, isikhala esihlukanisiwe, izinhlobo ze-trigger. |
ukubambezela | inombolo | into | 0 | ukubambezeleka ukubonisa nokufihla ithiphu yamathuluzi (ms) - ayisebenzi ohlotsheni lwesicuphi sesandla Uma inombolo inikezwa, ukubambezeleka kusetshenziswa kukho kokubili ukufihla/umbukiso Isakhiwo sento sithi: |
isitsha | umucu | amanga | amanga | Yengeza ithiphu entweni ethile |
- <a href = "#" data-toggle = "tooltip" title = "ithulusi lokuqala"> hambisa phezu kwami </a>
Inamathisela isibambi sethulithiphu eqoqweni le-elementi.
Iveza ithulithiphu yento ethile.
- $ ( '#element' ). ithiphu yamathuluzi ( 'show' )
Ifihla ithiphu yento ethile.
- $ ( '#element' ). ithiphu yamathuluzi ( 'fihla' )
Iguqula ithiphu lethuluzi le-elementi.
- $ ( '#element' ). ithiphu yamathuluzi ( 'guqula' )
Ifihla futhi ibhubhise ithiphu yento ethile.
- $ ( '#element' ). ithiphu yamathuluzi ( 'destroy' )
Engeza izimbondela ezincane zokuqukethwe, njengalezo eziku-iPad, kunoma iyiphi into ukuze uthole ulwazi lwesibili lwezindlu. Hambisa phezulu kwenkinobho ukuze uqalise i-popover. Idinga ithiphu yamathuluzi ukuthi ifakwe.
Kunezinketho ezine ezitholakalayo: kuqondaniswe phezulu, kwesokudla, phansi, nesobunxele.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. I-Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. I-Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. I-Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. I-Pellentesque ornare sem lacinia quam venenatis vestibulum.
Akukho makhaphu aboniswa njengama-popover akhiqizwa ku-JavaScript nokuqukethwe ngaphakathi data
kwesibaluli.
Nika amandla ama-popovers nge-JavaScript:
- $ ( '#isibonelo' ). i- popover ( izinketho )
Izinketho zingadluliswa ngezibaluli zedatha noma i-JavaScript. Ukuze uthole izibaluli zedatha, faka igama lenketho kokuthi data-
, njengaku data-animation=""
.
Igama | uhlobo | okuzenzakalelayo | incazelo |
---|---|---|---|
izithombe | boolean | iqiniso | sebenzisa inguquko ye-css fade ethiphu yamathuluzi |
html | boolean | amanga | Faka i-html ku-popover. Uma kungamanga, indlela ye-jquery text izosetshenziswa ukufaka okuqukethwe ku-dom. Sebenzisa umbhalo uma ukhathazekile ngokuhlaselwa kwe-XSS. |
ukubekwa | umucu | umsebenzi | 'kwesokudla' | indlela yokubeka i-popover - phezulu | phansi | kwesokunxele | kwesokudla |
isikhethi | umucu | amanga | uma kunikezwa isikhethi, izinto zethulithiphu zizodluliselwa kulokho okuhlosiwe |
inhlamvu | umucu | 'chofoza' | i-popover iqalwa kanjani - chofoza | hamba | gxila | imanuwali |
isihloko | umucu | umsebenzi | '' | inani lesihloko elizenzakalelayo uma isibaluli `sesihloko` singekho |
okuqukethwe | umucu | umsebenzi | '' | inani lokuqukethwe elizenzakalelayo uma isibaluli `sokuqukethwe kwedatha` singekho |
ukubambezela | inombolo | into | 0 | ukubambezeleka ukubonisa nokufihla i-popover (ms) - ayisebenzi ohlotsheni lwe-trigger okwenziwa ngesandla Uma inombolo inikezwa, ukubambezeleka kusetshenziswa kukho kokubili ukufihla/umbukiso Isakhiwo sento sithi: |
isitsha | umucu | amanga | amanga | Yengeza i-popover kusici esithile |
Ngezizathu zokusebenza, Ithulithiphu kanye ne-Popover data-apis zingena. Uma ungathanda ukuzisebenzisa vele ucacise inketho yesikhethi.
Iqalisa ama-popover eqoqo le-elementi.
Iveza i-popover yama-elementi.
- $ ( '#element' ). popover ( 'show' )
Ifihla i-popover yama-elementi.
- $ ( '#element' ). popover ( 'fihla' )
Iguqula i-popover yezinto.
- $ ( '#element' ). i- popover ( 'guqula' )
Ifihla futhi icekele phansi i-popover yento.
- $ ( '#element' ). i- popover ( 'destroy' )
Engeza umsebenzi wokucashisa kuyo yonke imilayezo yesixwayiso enale plugin.
Shintsha lokhu nalokhu bese uzama futhi. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. I-Cras mattis consectetur purus sit amet fermentum.
Nika amandla ukuchithwa kwesexwayiso nge-JavaScript:
- $ ( ".isaziso" ). qaphela ()
Vele ungeze data-dismiss="alert"
enkinobheni yakho yokuvala ukuze unikeze ngokuzenzakalelayo ukusebenza kwesexwayiso sokuvala.
- <a class = "close" data-dismiss = "alert" href = "#" > × </a>
Igoqa zonke izexwayiso ngokusebenza okuseduze. Ukuze izexwayiso zakho zigqwayize uma zivaliwe, qiniseka ukuthi sezisetshenzisiwe .fade
futhi .in
nekilasi kuzo.
Ivala isexwayiso.
- $ ( ".isaziso" ). isixwayiso ( 'vala' )
Ikilasi lesexwayiso le-Bootstrap lidalula imicimbi embalwa ukuze ixhumeke ekusebenzeni kwesixwayiso.
Umcimbi | Incazelo |
---|---|
vala | Lo mcimbi uvutha ngokushesha lapho close indlela yesibonelo ibizwa. |
ivaliwe | Lo mcimbi uyaxoshwa uma isaziso sivaliwe (sizolinda ukuthi izinguquko ze-css ziqedele). |
- $ ( '#isaziso sami' ). bopha ( 'kuvaliwe' , umsebenzi () {
- // enza into…
- })
Thola izitayela eziyisisekelo nosekelo oluguquguqukayo lwezingxenye ezigoqekayo njengama-accordion nokuzulazula.
* Idinga i-plugin ye-Transitions ukuthi ifakwe.
Sisebenzisa i-plugin yokugoqa, sakhe iwijethi yesitayela se-accordion elula:
- <div class = "i-accordion" id = "i-accordion2" >
- <div class = "iqembu le-accordion" >
- <div class = "isihloko se-accordion" >
- <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseOne" >
- Into Yeqembu Egoqekayo #1
- </a>
- </div>
- <div id = "collapseOne" class = "i-accordion-body collapse" >
- <div class = "i-accordion-inner" >
- Anim pariatur cliche...
- </div>
- </div>
- </div>
- <div class = "iqembu le-accordion" >
- <div class = "isihloko se-accordion" >
- <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseTwo" >
- Into Yeqembu Egoqekayo #2
- </a>
- </div>
- <div id = "collapseTwo" class = "i-accordion-body collapse" >
- <div class = "i-accordion-inner" >
- Anim pariatur cliche...
- </div>
- </div>
- </div>
- </div>
- ...
Ungasebenzisa futhi i-plugin ngaphandle kwemakhaphu ye-accordion. Yenza inkinobho iguqule ukunwetshwa nokugoqa kwenye i-elementi.
- <button type = "button" class = "btn btn-danger" data-toggle = "collapse" data-target = "#demo" >
- elula egoqekayo
- </inkinobho>
- <div id = "demo" class = "goqa phakathi" > … </div>
Vele ungeze data-toggle="collapse"
futhi u-a data-target
ku-elementi ukuze unikeze ngokuzenzakalelayo ukulawula kwento egoqekayo. Isibaluli data-target
samukela isikhethi se-css ongafaka kuso ukugoqa. Qiniseka ukuthi ungeza ikilasi collapse
ku-elementi egoqekayo. Uma ungathanda ukuthi ivuleke ngokuzenzakalelayo, engeza iklasi elengeziwe in
.
Ukuze ungeze ukuphathwa kweqembu okufana ne-accordion kusilawuli esigoqekayo, engeza isibaluli sedatha data-parent="#selector"
. Bheka idemo ukuze ubone lokhu kusebenza.
Nika amandla ngokwenza nge:
- $ ( ".goqa" ). bhidliza ()
Izinketho zingadluliswa ngezibaluli zedatha noma i-JavaScript. Ukuze uthole izibaluli zedatha, faka igama lenketho kokuthi data-
, njengaku data-parent=""
.
Igama | uhlobo | okuzenzakalelayo | incazelo |
---|---|---|---|
umzali | isikhethi | amanga | Uma isikhethi khona-ke zonke izici ezigoqekayo ngaphansi komzali othile zizovalwa lapho le nto egoqekayo iboniswa. (okufana nokuziphatha kwe-accordion yendabuko) |
guqula | boolean | iqiniso | Iguqula into egoqekayo ekunxuseni |
Yenza okuqukethwe kwakho kusebenze njengento egoqekayo. Yamukela izinketho ozikhethela object
.
- $ ( '#myCollapsible' ). bhidlika ({
- guqula : amanga
- })
Iguqula into egoqekayo ukuze iboniswe noma ifihlwe.
Ibonisa into egoqekayo.
Ifihla into egoqekayo.
Ikilasi lokugoqa le-Bootstrap lidalula imicimbi embalwa ukuze ixhumeke ekusebenzeni kokugoqa.
Umcimbi | Incazelo |
---|---|
umbukiso | Lo mcimbi uvutha ngokushesha lapho show indlela yesibonelo ibizwa. |
kubonisiwe | Lo mcimbi uxoshwa lapho isici sokugoqa senziwe sabonakala kumsebenzisi (sizolinda ukuthi izinguquko ze-css ziqedele). |
fihla | Lo mcimbi uxoshwa ngokushesha lapho hide indlela isibiziwe. |
kufihliwe | Lo mcimbi uxoshwa lapho isici sokugoqa sifihliwe kumsebenzisi (sizolinda ukuthi izinguquko ze-css ziqedele). |
- $ ( '#myCollapsible' ). ku ( 'kufihliwe' , umsebenzi () {
- // enza into…
- })
Umbukiso wesilayidi ongezansi ubonisa i-plugin evamile kanye nengxenye yokuhamba ngebhayisikili ezintweni ezifana ne-carousel.
- <div id = "myCarousel" class = "carousel slide" >
- <ol class = "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 ze-carousel -->
- <div class = "i-carousel-inner" >
- <div class = "into esebenzayo" > … </div>
- <div class = "into" > … </div>
- <div class = "into" > … </div>
- </div>
- <!-- I-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>
Sebenzisa izibaluli zedatha ukuze ulawule kalula ukuma kwe-carousel. data-slide
yamukela amagama angukhiye prev
noma next
, eshintsha indawo yesilayidi ngokuhlobene nendawo yaso yamanje. Kungenjalo, sebenzisa data-slide-to
ukudlulisa inkomba yesilayidi eluhlaza ku-carousel data-slide-to="2"
, eyeqa indawo yesilayidi enkombeni ethile eqala ngo- 0
.
Shayela i-carousel ngokwenza:
- $ ( '.carousel' ). i- carousel ()
Izinketho zingadluliswa ngezibaluli zedatha noma nge-JavaScriptz. Ukuze uthole izibaluli zedatha, faka igama lenketho kokuthi data-
, njengaku data-interval=""
.
Igama | uhlobo | okuzenzakalelayo | incazelo |
---|---|---|---|
isikhawu | inombolo | 5000 | Inani lesikhathi sokubambezeleka phakathi kokuhamba ngebhayisikili ngokuzenzakalela into. Uma kungamanga, i-carousel ngeke ijikeleze ngokuzenzakalelayo. |
thula kancane | umucu | "hambahamba" | Imisa ibhayisikili le-carousel ku-mouseenter futhi iqalise kabusha ukujikeleza kwe-carousel ku-mouseleave. |
Iqalisa i-carousel ngezinketho zokuzithandela object
futhi iqala ukuhamba ngebhayisikili ezintweni.
- $ ( '.carousel' ). i- carousel ({
- Isikhathi : 2000
- })
Izungeza izinto ze-carousel ukusuka kwesokunxele kuye kwesokudla.
Imisa i-carousel ekuhambeni ngebhayisikili ezintweni.
Ibiyela i-carousel kuhlaka oluthile (okusekelwe ngo-0, okufana namalungu afanayo).
Imijikelezo eya entweni edlule.
Imijikelezo eya entweni elandelayo.
Ikilasi le-carousel le-Bootstrap lidalula imicimbi emibili yokuxhunywa ekusebenzeni kwe-carousel.
Umcimbi | Incazelo |
---|---|
shelela | Lo mcimbi uvutha ngokushesha lapho slide indlela yesibonelo isetshenziswa. |
shibilika | Lo mcimbi uxoshwa lapho i-carousel isiqedile ukuguqulwa kwama-slide. |
I-plugin eyisisekelo, enwetshwe kalula yokudala ngokushesha ama-typehead amahle nganoma iyiphi indlela yokufaka umbhalo.
- <input type = "text" data-provide = "typeahead" >
Uzofuna ukusetha autocomplete="off"
ukuze uvimbele amamenyu esiphequluli azenzakalelayo ukuthi angaveli phezu kokwehla kohlobo lwe-Bootstrap.
Engeza izibaluli zedatha ukuze ubhalise i-elementi ngokusebenza kwe-typeahead njengoba kuboniswe kusibonelo esingenhla.
Shayela i-typeahead mathupha ngokuthi:
- $ ( '.typeahead' ). i-typehead ()
Izinketho zingadluliswa ngezibaluli zedatha noma i-JavaScript. Ukuze uthole izibaluli zedatha, faka igama lenketho kokuthi data-
, njengaku data-source=""
.
Igama | uhlobo | okuzenzakalelayo | incazelo |
---|---|---|---|
umthombo | uhlu, umsebenzi | [ ] | Umthombo wedatha ongabuza ngawo. Kungaba uchungechunge lwezintambo noma umsebenzi. Umsebenzi uphasiswe izimpikiswano ezimbili, query inani elisendaweni yokufaka kanye ne- process callback. Umsebenzi ungasetshenziswa ngokuhambisanayo ngokubuyisela umthombo wedatha ngokuqondile noma ngokuhambisanayo nge- process agumenti eyodwa ye-callback. |
izinto | inombolo | 8 | Inombolo enkulu yezinto ezoboniswa kokwehliswayo. |
minLength | inombolo | 1 | Ubude bezinhlamvu obuncane obudingekayo ngaphambi kokucupha iziphakamiso zokuqedela ngokuzenzakalela |
umenzi | umsebenzi | icala alizwani | Indlela esetshenziswa ukunquma ukuthi umbuzo ufana nento ethile. Yamukela i-agumenti eyodwa, item okuzovivinywa ngayo umbuzo. Finyelela embuzweni wamanje nge- this.query . Buyisa i-boolean true uma umbuzo ufana. |
umhleli | umsebenzi | ukufana ncamashi, ukuzwela kwecala, akuzwakali |
Indlela esetshenzisiwe ukuhlunga imiphumela yokuqedela ngokuzenzakalela. Yamukela impikiswano eyodwa items futhi inobubanzi besibonelo se-typeahead. Bhekisela umbuzo wamanje ngokuthi this.query . |
isithuthukisi | umsebenzi | ibuyisela into ekhethiwe | Indlela esetshenzisiwe ukubuyisela into ekhethiwe. Yamukela impikiswano eyodwa, item futhi inobubanzi besibonelo se-typeahead. |
i-highlighter | umsebenzi | igqamisa konke okufanayo okuzenzakalelayo | Indlela esetshenzisiwe ukugqamisa imiphumela yokuqedela ngokuzenzakalela. Yamukela impikiswano eyodwa item futhi inobubanzi besibonelo se-typeahead. Kufanele ibuyise i-html. |
Iqalisa okokufaka nge-typeahead.
Ukuzulazula okungaphansi kwesokunxele kuyidemo ebukhoma ye-plugin ye-affix.
Ukwengeza kalula ukuziphatha kokunamathisela kunoma iyiphi i-elementi, vele ungeze data-spy="affix"
ku-elementi ofuna ukuyihlola. Bese usebenzisa ama-offsets ukuchaza ukuthi ushintsha nini ukuphina kwe-elementi uvule futhi ukuvale.
- <div data-spy = "affix" data-offset-top = "200" > ... </div>
affix
,
affix-top
, kanye
affix-bottom
. Khumbula ukuhlola umzali okungenzeka ukuthi ugoqe lapho isinamathiselo singena njengoba sikhipha okuqukethwe ekuhambeni okuvamile kwekhasi.
Shayela i-plugin ye-affix nge-JavaScript:
- $ ( '#navbar' ). namathisela ()
Izinketho zingadluliswa ngezibaluli zedatha noma i-JavaScript. Ukuze uthole izibaluli zedatha, faka igama lenketho kokuthi data-
, njengaku data-offset-top="200"
.
Igama | uhlobo | okuzenzakalelayo | incazelo |
---|---|---|---|
offset | inombolo | umsebenzi | into | 10 | Amaphikseli okufanele uwasuse esikrinini uma ubala indawo yokuskrola. Uma inombolo eyodwa inikezwa, i-offset izosetshenziswa kuzo zombili izikhombisi-ndlela eziphezulu nesobunxele. Ukuze ulalele isiqondiso esisodwa, noma ama-offset amaningi ahlukile, vele unikeze into offset: { x: 10 } . Sebenzisa umsebenzi uma udinga ukuhlinzeka ngokushintshashintshayo (okuwusizo kweminye imiklamo esabelayo). |