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').off('.data-api')
Okunye, ukuze uqondise i-plugin ethile, vele ufake igama le-plugin njengendawo yegama kanye nendawo yegama yedatha-api kanje:
$('umzimba').off('.alert.data-api')
Sikholelwa futhi ukuthi kufanele ukwazi ukusebenzisa wonke ama-plugin e-Bootstrap nge-JavaScript API. Wonke ama-API asesidlangalaleni ayindlela eyodwa, esebenzisekayo, 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").modal() // iqaliswe ngokuzenzakalelayo $("#myModal").modal({ keyboard: false }) // iqaliswe ngaphandle kwekhibhodi $("#myModal").modal('show') // iqalisa futhi icela 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')
.
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 amandla okumisa ukwenziwa kwesenzo ngaphambi kokuthi siqale.
$('#MyModal').on('show', function (e) { uma (!idatha) ibuyisela i-e.preventDefault() // imisa i-modal ukuthi iboniswe })
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">&izikhathi;</button> <h3>Iheda yemodeli</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">Inhlokweni yemodeli</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</inkinobho> <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">Yethula indlela</inkinobho>
Shayela i-modal ene-id myModal
enomugqa owodwa we-JavaScript:
$('#MyModal').modal(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 | Kufaka phakathi 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').modal({ ikhibhodi: amanga })
Iguqula ngokwenza i-modal.
$('#MyModal').modal('guqula')
Ivula mathupha i-modal.
$('#MyModal').modal('show')
Ifihla i-modal ngokwenza.
$('#MyModal').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').on('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="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#">I-trigger yokwehlisa</a> <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"> ... </ul> </div>
Ukuze ugcine ama-URL eqinile, sebenzisa data-target
isibaluli esikhundleni se- href="#"
.
<div class="dropdown"> <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="menu" aria-labelledby="dLabel"> ... </ul> </div>
Shayela okwehliswayo nge-JavaScript:
$('.ukuguqula-ukuguqula').ukwehliswa()
Lutho
I-api ehleliwe yokuguqula amamenyu ku-navbar enikeziwe 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 lejezi le-cosby eline-tattoo, i-mcsweeney's quis non freegan vinyl. I-Lo-fi wes anderson +1 sartorial. I-Carles non-aesthetic exercitation i-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.
Epaki ye-echo ye-incididunt, u-officia deserunt umpetha ka-mcsweeney uhlanza ama-thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft ubhiya. Abahambi bekhofi eliwumsuka owodwa baphuza i-loko eline, cupidatat terry richardson master cleanse. Assumenda cishe awuzange uzwe ngabo art party fanny pack, tattooed nulla cardigan tempor isikhangiso. Proident wolf nesciunt sartorial keffiyeh eu banh mi esimeme. Elit wolf voluptate, lo-fi ea portland ngaphambi kokuba bathengise amaloko amane. Locavore enim nostrud mlkshk brooklyn nesciunt.
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.
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:
$('#i-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"]').ngalinye(umsebenzi () { var $spy = $(lokhu).scrollspy('vuselela') });
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 ku-transiton ngokusebenzisa amafasitelana okuqukethwe 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.
I-fixie locavore yeloli lokudla, i-accusamus mcsweeney's marfa nulla single-origin coffee squid. Ukuzivivinya +1 i-labore velit, i-blog sartorial PBR leggings ezingeni elilandelayo 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. I-Homo nostrud organic, i-imagesnda labore magna deelectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. I-Vegan fanny pack odio cillum wes anderson 8-bit, intshebe eqinile ye-jean shorts ut DIY ethical culpa terry richardson biodiesel. I-Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.
I-Etsy mixtape wayfarers, ethical wes anderson tofu ngaphambi kokuthi bathengise nge-organic lomo retro fanny pack lo-fi farm-to-table readymade. Isikhwama se-Messenger gentrify pitchfork tattooed craft ubhiya, i-iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. I-DIY synth PBR indida yasebhange. I-Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred cishe awuzange uzwe ngabo, vinyl izikebhe ubhiya blog stumptown. I-Pitchfork eqhubekayo ye-tofu synth chambray ngonyaka.
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 ngayodwa):
$('#myTab a').chofoza(umsebenzi (e) { e.preventDefault(); $(this).tab('show'); })
Ungavula amathebhu ngamanye ngezindlela ezimbalwa:
$('#myTab a[href="#profile"]').tab('show'); // Khetha ithebhu ngegama $('#MyTab a:first').tab('show'); // Khetha ithebhu yokuqala $('#MyTab a:last').tab('show'); // Khetha ithebhu yokugcina $('#myTab li:eq(2) a').tab('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 nav-tabs"> <li><a href="#home" data-toggle="tab">Ekhaya</a></li> <li><a href="#profile" data-toggle="tab">Iphrofayela</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">Ekhaya</a></li> <li><a href="#profile">Iphrofayela</a></li> <li><a href="#imiyalezo">Imilayezo</a></li> <li><a href="#settings">Izilungiselelo</a></li> </ul> <div class="tab-content"> <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="settings">...</div> </div> <script> $(umsebenzi () { $('#MyTab a:last').tab('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.
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.
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 | 'hambahamba' | ukuthi ithiphu yamathuluzi icushwa kanjani - chofoza | hamba | gxila | imanuwali |
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: |
Ngenxa yezizathu zokusebenza, Ithulithiphu kanye ne-Popover data-apis zingena. Uma ungathanda ukuzisebenzisa vele ucacise inketho yesikhethi.
<a href="#" rel="tooltip" title="first tooltip">hamba phezu kwami</a>
Inamathisela isibambi sethulithiphu eqoqweni lesici.
Iveza ithulithiphu yento ethile.
$('#element').ithulusi('show')
Ifihla ithiphu yento ethile.
$('#element').ithulusi('fihla')
Iguqula ithiphu lethuluzi le-elementi.
$('#element').ithiphu yethuluzi('guqula')
Ifihla futhi ibhubhise ithiphu yento ethile.
$('#element').ithulusi('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.
Awekho umaki oboniswa njengama-popover akhiqizwa ku-JavaScript nokuqukethwe ngaphakathi data
kwesibaluli.
Nika amandla ama-popovers nge-JavaScript:
$('#isibonelo').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: |
Ngenxa yezizathu 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').popover('guqula')
Ifihla futhi icekele phansi i-popover yento.
$('#element').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:
$(".alert").isaziso()
Vele ungeze data-dismiss="alert"
enkinobheni yakho yokuvala ukuze unikeze ngokuzenzakalelayo ukusebenza kwesexwayiso sokuvala.
<a class="close" data-dismiss="alert" href="#">&izikhathi;</a>
Igoqa zonke izexwayiso ngokusebenza okuseduze. Ukuze izexwayiso zakho zigqwayize uma zivaliwe, qiniseka ukuthi sezisetshenzisiwe .fade
futhi .in
nekilasi kuzo.
Ivala isexwayiso.
$(".alert").isaziso('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). |
$('#my-alert').bind('ivaliwe', 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="accordion" id="accordion2"> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne"> Into Yeqembu Egoqekayo #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"> Into Yeqembu Egoqekayo #2 </a> </div> <div id="collapseTwo" class="accordion-body collapse"> <div class="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="collapse in"> … </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").goqa()
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').goqa({ 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').on('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"> <!-- Izinto ze-carousel --> <div class="carousel-inner"> <div class="active item">…</div> <div class="item">…</div> <div class="item">…</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>
...
Shayela i-carousel ngokwenza:
$('.carousel').carousel()
Izinketho zingadluliswa ngezibaluli zedatha noma i-JavaScript. 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. |
ima 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').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">
Engeza izibaluli zedatha ukuze ubhalise i-elementi ngokusebenza kwe-typeahead njengoba kuboniswe kusibonelo esingenhla.
Shayela i-typeahead mathupha ngokuthi:
$('.typeahead').typeahead()
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 ngendlela efanayo 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 esetshenziselwa 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').affix()
Uma usebenzisa i-affix ngokuhambisana nokwengeza noma ukukhipha izakhi ku-DOM, uzofuna ukushayela indlela yokuvuselela:
$('[data-spy="affix"]').ngalinye(umsebenzi () { $(lokhu).namathisela('vuselela') });
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 kunikezwa inombolo eyodwa, i-offset izosetshenziswa kuzo zombili izikhombisi-ndlela eziphezulu nesobunxele. Ukuze ulalele isiqondiso esisodwa, noma ama-offset amaningi ahlukile, nikeza nje into offset: { x: 10 } . Sebenzisa umsebenzi uma udinga ukuhlinzeka ngokushintshashintshayo (okuwusizo kweminye imiklamo esabelayo). |