JavaScript

Zisa izinto ze-Bootstrap ebomini-ngoku kunye neeplagi ze-jQuery zesiko ezili-13.

Iintloko phezulu! La maxwebhu ngawe-v2.3.2, engasaxhaswanga ngokusemthethweni. Jonga inguqulelo yamva nje yeBootstrap!

Umntu ngamnye okanye uqokelelwe

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.

Iimpawu zedatha

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:

  1. $ ( 'umzimba' ). cima ( '.data-api' )

Kungenjalo, ukujolisa iplagin ethile, faka nje igama leplagi njengendawo yegama kunye ne-data-api namespace efana nale:

  1. $ ( 'umzimba' ). cima ( '.alert.data-api' )

Programmatic API

Sikwakholelwa ukuba kufuneka ukwazi ukusebenzisa zonke iiplagi zeBootstrap ngeJavaScript API. Zonke ii-API zikawonke-wonke zinye, iindlela ezibolekwayo, kwaye zibuyisela ingqokelela eyenziwayo.

  1. $ ( ".btn.danger" ). iqhosha ( "toggle" ). addClass ( "amafutha" )

Zonke iindlela kufuneka zamkele into ekhethiweyo yeenketho, umtya ojolise kwindlela ethile, okanye akukho nto (eqalisa iplagin ngokuziphatha okungagqibekanga):

  1. $ ( "#myModal" ). imodal () // iqaliswe ngokumiselweyo
  2. $ ( "#myModal" ). imodal ({ ikhibhodi : bubuxoki }) // iqaliswe ngaphandle kwebhodi yezitshixo
  3. $ ( "#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').

Akukho kungquzulwano

Ngamanye amaxesha kuyimfuneko ukusebenzisa iiplagi ze-Bootstrap kunye nezinye izikhokelo ze-UI. Kwezi meko, ukungqubana kwesithuba segama kunokwenzeka ngamanye amaxesha. Ukuba oku kuyenzeka, .noConflictungafowunela iplagin onqwenela ukubuyisela ixabiso layo.

  1. var bootstrapButton = $ . fn . iqhosha . noConflict () // buyisela i-$.fn.iqhosha kwixabiso ebelibekelwe ngaphambili
  2. $ . fn . i- bootstrapBtn = iqhosha le- bootstrap // nika i-$().bootstrapBtn umsebenzi we-bootstrap

Iziganeko

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.

  1. $ ( '#myModal' ). kwi ( 'bonisa' , umsebenzi ( e ) {
  2. ukuba (! data ) buyisela e . preventDefault () // iyamisa imodal ekubonisweni
  3. })

Malunga neenguqu

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.

Sebenzisa iimeko

Imizekelo embalwa ye-plugin yotshintsho:

  • Ukutyibilika okanye ukuncipha kwiimodyuli
  • Ukucima iithebhu
  • Ukucima izilumkiso
  • Iipaneli zecarousel ezityibilikayo

Imizekelo

Iimodyuli zilungelelanisiwe, kodwa zibhetyebhetye, iingxoxo zencoko yababini ezinobuncinci obufunekayo obufunekayo kunye nokungagqibekanga okuhlakaniphile.

Umzekelo omileyo

Imodali enikezelweyo enesihloko, umzimba, kunye neseti yezenzo kumbhalo osemazantsi.

  1. <div iklasi = "i-modal hide fade" >
  2. <div class = "modal-header" >
  3. < uhlobo lweqhosha = "iqhosha" class = "close" data-dismiss = "modal" aria-hidden = "true" > × </ iqhosha>
  4. <h3> imodal header </h3>
  5. </ div>
  6. <div class = "modal-body" >
  7. <p> Umzimba omnye olungileyo… </p>
  8. </ div>
  9. <div class = "modal-footer" >
  10. <a href = "#" iklasi = "btn"> Vala </a> _
  11. <a href = "#" class = "btn btn-primary"> Gcina utshintsho </a>
  12. </ div>
  13. </ div>

Idemo ephilayo

Guqula imodal usebenzisa iJavaScript ngokucofa iqhosha elingezantsi. Iza kutyibilika phantsi kwaye iphele ukusuka phezulu ephepheni.

  1. <!-- Iqhosha lokucupha imodal -->
  2. <a href = "#myModal" role = "iqhosha" iklasi = "btn" data-toggle = "modal"> Qalisa indlela yedemo </a>
  3.  
  4. <!-- Modal -->
  5. <div id = "myModal" class = "modal hide fade" tabindex = "-1" indima = "dialog" aria-labelledby = "myModalLabel" aria- hidden = "true" >
  6. <div class = "modal-header" >
  7. < uhlobo lweqhosha = "iqhosha" class = "close" data-dismiss = "modal" aria-hidden = "true" > × </ iqhosha>
  8. <h3 id = "myModalLabel" > Intloko yeModal </h3>
  9. </ div>
  10. <div class = "modal-body" >
  11. <p> Umzimba omnye olungileyo… </p>
  12. </ div>
  13. <div class = "modal-footer" >
  14. < iklasi yeqhosha = "btn" data-dismiss = "modal" aria-hidden = "true" > Vala </ iqhosha>
  15. < iklasi yeqhosha = "btn btn-primary" > Gcina utshintsho </ iqhosha>
  16. </ div>
  17. </ div>

Ukusetyenziswa

Ngeempawu zedatha

Vula imodali ngaphandle kokubhala iJavaScript. Cwangcisa data-toggle="modal"isiqalelo somlawuli, njengeqhosha, kunye ne data-target="#foo"okanye href="#foo"ukujolisa kwindlela ethile yokuguqula.

  1. < uhlobo lweqhosha = "iqhosha" data-toggle = "modal" data-target = "#myModal" > Yandulula indlela </iqhosha>

NgeJavaScript

Fowunela i-modal ene-id myModalngomgca omnye weJavaScript:

  1. $ ( '#myModal' ). imodeli ( iinketho )

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 staticimeko 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 loadkwaye utofwe kwi .modal-body. Ukuba usebenzisa i-api yedatha, ungasebenzisa ngenye indlela hrefithegi ukukhankanya umthombo okude. Umzekelo woku uboniswe ngezantsi:

  1. <a data-toggle="modal" href="remote.html" data-target="#modal">click me</a>

Iindlela

.modal(iinketho)

Yenza umxholo wakho ube yimodali. Yamkela iinketho ozikhethelayo object.

  1. $ ( '#myModal' ). imodeli ({
  2. keyboard : bubuxoki
  3. })

.modal('tshintsha')

Yenza imodal ngesandla.

  1. $ ( '#myModal' ). imodali ( 'tshintsha' )

.imodal('umboniso')

Ivula imodali ngesandla.

  1. $ ( '#myModal' ). imodali ( 'bonisa' )

.modal('fihla')

Ufihla imodali ngesandla.

  1. $ ( '#myModal' ). imodali ( 'fihla' )

Iziganeko

Iklasi ye-modal ye-Bootstrap iveza iminyhadala embalwa yokuqhagamshelwa ekusebenzeni kwe-modal.

Isiganeko Inkcazo
bonisa Esi siganeko sivutha ngokukhawuleza xa showkubizwa 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 hideindlela yomzekelo ibiziwe.
efihliweyo Esi siganeko siyagxothwa xa imodal igqibile ukufihlwa kumsebenzisi (iya kulinda css iinguqu ukuba igqibe).
  1. $ ( '#myModal' ). kwi ( 'ifihliwe' , umsebenzi () {
  2. // Yenza into…
  3. })

Umzekelo kwi-navbar

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.

@fat

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.

@mdo

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.

Nye

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.

Mbini

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.

three

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.


Ukusetyenziswa

Ngeempawu zedatha

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 .navnecandelo.

  1. <body data-spy = "scroll" data-target = ".navbar" > ... </ body>

NgeJavaScript

Fowunela iscrollspy ngeJavaScript:

  1. $ ( '#navbar' ). skrola ()
Iintloko phezulu! Unxulumano lwebar yeNavbar kufuneka lube nethagethi ye-id enokusombululeka. Umzekelo, <a href="#home">home</a>kufuneka ihambelane nento ekwidom efana <div id="home"></div>.

Iindlela

.skrola('hlaziya')

Xa usebenzisa i-scrollspy ngokudibanisa okanye ukususa izinto kwi-DOM, kuya kufuneka ufowunele indlela yokuhlaziya ngolu hlobo:

  1. $ ( '[data-spy="scroll"]' ). Nganye ( umsebenzi () {
  2. var $ hlola = $ ( le ). scrollspy ( 'hlaziya' )
  3. });

Iinketho

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.

Iziganeko

Isiganeko Inkcazo
vula Esi siganeko sivutha nanini na into entsha ivuliwe yi-scrollspy.

Iithebhu zemizekelo

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.


Ukusetyenziswa

Yenza iithebhu ezinokubakho ngeJavaScript (ithebhu nganye kufuneka ivulwe ngokwayo):

  1. $ ( '#myTab a' ). cofa ( umsebenzi ( e ) {
  2. e . preventDefault ();
  3. $ ( oku ). ithebhu ( 'bonisa' );
  4. })

Unokwenza ithebhu nganye isebenze ngeendlela ezininzi:

  1. $ ( '#myTab a[href="#profile"]' ). ithebhu ( 'bonisa' ); // Khetha isithuba ngegama
  2. $ ( '#myTab a:first' ). ithebhu ( 'bonisa' ); // Khetha ithebhu yokuqala
  3. $ ( '#myTab a:last' ). ithebhu ( 'bonisa' ); // Khetha isithuba sokugqibela
  4. $ ( '#myTab li:eq(2) a' ). ithebhu ( 'bonisa' ); // Khetha ithebhu yesithathu (0-isalathisi)

IMarkup

Unokwenza ithebhu okanye ukukhangela iipilisi ngaphandle kokubhala nayiphi na iJavaScript ngokuchaza ngokulula data-toggle="tab"okanye data-toggle="pill"kwinto. Ukongeza i navkunye nav-tabsneeklasi kwithebhu ulkuya kusebenzisa isitayile se-Bootstrap tab.

  1. <ul iklasi = "nav-tabs" >
  2. <li><a href = "#ikhaya" data-toggle = "tab"> Ekhaya </a> < /li>
  3. <li><a href = "#profile" data-toggle = "tab"> Inkangeleko yesimo </a></li >
  4. <li><a href = "# imiyalezo" data-toggle = "tab"> Imiyalezo </a> < /li>
  5. <li><a href = "#settings" data-toggle = "tab"> Useto </a> </li>
  6. </ul>

Iindlela

$().tab

Yenza isiqalelo sethebhu kunye nesiqulatho sisebenze. Isithuba kufuneka sibenendawo data-targetokanye indawo hrefyesikhongozeli kwiDOM.

  1. <ul class = "nav nav-tabs" id = "myTab" >
  2. <li iklasi = "esebenzayo" > <a href = "#ikhaya"> Ekhaya </a></li>
  3. <li><a href = "#profile"> Inkangeleko yesimo </a></li>
  4. <li><a href = "#imiyalezo"> Imiyalezo </a> </li>
  5. <li><a href = "#iisetingi"> Useto </a> </li>
  6. </ul>
  7.  
  8. <div class = "ithebhu-umxholo" >
  9. <div class = "i-tab-pane esebenzayo" id = "ikhaya" > ... </div>
  10. <div class = "i-tab-pane" id = "iprofayile" > ... </div>
  11. <div class = "i-tab-pane" id = "imiyalezo" > ... </div>
  12. <div class = "i-tab-pane" id = "iisetingi" > ... </div>
  13. </ div>
  14.  
  15. <script>
  16. $ ( umsebenzi () {
  17. $ ( '#myTab a:last' ). ithebhu ( 'bonisa' );
  18. })
  19. </script>

Iziganeko

Isiganeko Inkcazo
bonisa Esi siganeko sivutha kumboniso wethebhu, kodwa ngaphambi kokuba ithebhu entsha iboniswe. Sebenzisa event.targetkunye event.relatedTargetnokujolisa isithuba esisebenzayo kunye nesithuba sangaphambili esisebenzayo (ukuba sikhona) ngokulandelelanayo.
ibonisiwe Esi siganeko sitshisa kwi-tab show emva kokuba ithebhu ibonisiwe. Sebenzisa event.targetkunye event.relatedTargetnokujolisa isithuba esisebenzayo kunye nesithuba sangaphambili esisebenzayo (ukuba sikhona) ngokulandelelanayo.
  1. $ ( 'a[data-toggle="tab"]' ). kwi ( 'ibonisiwe' , umsebenzi ( e ) {
  2. e . ekujoliswe kuko // ithebhu evuliwe
  3. e . relatedTarget // ithebhu yangaphambili
  4. })

Imizekelo

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.

Iindlela ezine

Iingcebiso kumaqela egalelo

Xa usebenzisa iincam zesixhobo kunye neepopovers ngamaqela egalelo leBootstrap, kuya kufuneka usete i container(ebhalwe ngezantsi) ukhetho ukuphepha iziphumo ebezingalindelekanga ezingafunekiyo.


Ukusetyenziswa

Qalisa ingcebiso yesixhobo ngeJavaScript:

  1. $ ( '#example' ). incam yesixhobo ( iinketho )

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 textizakusetyenziswa 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:delay: { show: 500, hide: 100 }

isikhongozeli umtya | bubuxoki bubuxoki

Ihlomela incam yesixhobo kwinto ethilecontainer: 'body'

Iintloko phezulu! Iinketho zeengcebiso zesixhobo ngasinye zinokuchazwa ngokusetyenziswa kweempawu zedatha.

IMarkup

  1. <a href = "#" data-toggle = "tooltip" title = "tooltip yokuqala"> hambisa phezu kwam </a>

Iindlela

$().ingcebiso yesixhobo(iinketho)

Iqhoboshela isibambi sesixhobo kwingqokelela yesiqalelo.

.ingcebiso yesixhobo('bonisa')

Ityhila inqaku lesixhobo.

  1. $ ( '#isiqalelo' ). incam yesixhobo ( 'bonisa' )

.ingcebiso yesixhobo('fihla')

Ifihla incam yesixhobo.

  1. $ ( '#isiqalelo' ). incam yesixhobo ( 'fihla' )

.ingcebiso yesixhobo('tshintsha')

Itshintshela incam yesixhobo.

  1. $ ( '#isiqalelo' ). incam yesixhobo ( 'toggle' )

.ingcebiso yesixhobo('yonakalisa')

Ifihla kwaye itshabalalise isixhobo sesixhobo.

  1. $ ( '#isiqalelo' ). incam yesixhobo ( 'yonakalisa' )

Imizekelo

Yongeza imixholo emincinci, njengaleyo ikwi-iPad, kuyo nayiphi na into yolwazi lwesibini lwezindlu. Hambisa ngaphezulu kweqhosha ukuqalisa ipopover. Ifuna iTip yesixhobo ukuba ibandakanywe.

Ipopover engatshintshiyo

Zine iinketho ezikhoyo: phezulu, ekunene, ezantsi, nasekhohlo zilungelelanisiwe.

Pover top

Sed posuere consectetur est at lobortis. Aenean eu leo ​​quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.

Popover ekunene

Sed posuere consectetur est at lobortis. Aenean eu leo ​​quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.

Umzantsi wePover

Sed posuere consectetur est at lobortis. Aenean eu leo ​​quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.

UPopover washiya

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 datakophawu.

Idemo ephilayo

Iindlela ezine


Ukusetyenziswa

Vumela iipopovers ngeJavaScript:

  1. $ ( '#example' ). popover ( iinketho )

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 textizakusetyenziswa 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:delay: { show: 500, hide: 100 }

isikhongozeli umtya | bubuxoki bubuxoki

Ifakela ipopover kwinto ethilecontainer: 'body'

Iintloko phezulu! Ukhetho lwepopovers ngamanye lunokuchazwa ngokusetyenziswa kweempawu zedatha.

IMarkup

Ngenxa yezizathu zokusebenza, iSixhobo kunye nePopover data-apis zingenile.

Iindlela

$().popover(iinketho)

Uqalisa iipopovers zengqokelela yezinto.

.popover('bonisa')

Ityhila i-elementi popover.

  1. $ ( '#isiqalelo' ). popover ( 'bonisa' )

.popover('fihla')

Ifihla i-elements popover.

  1. $ ( '#isiqalelo' ). popover ( 'fihla' )

.popover('tshintsha')

Itshintshela izinto popover.

  1. $ ( '#isiqalelo' ). ipopover ( 'tshintsha' )

.popover('yonakalisa')

Ifihla kwaye itshabalalise i-element's popover.

  1. $ ( '#isiqalelo' ). ipopover ( 'yonakalisa' )

Izaziso zemizekelo

Yongeza umsebenzi wokugxotha kuyo yonke imiyalezo yesivuseleli ngale plugin.

I-guacamole engcwele! Eyona nto uyifunayo, awujongeki ulunge kakhulu.

Owu khawuleza! Unempazamo!

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.

Thatha eli nyathelo Okanye yenza oku


Ukusetyenziswa

Vula ukugxothwa kwesivuseleli ngeJavaScript:

  1. $ ( ".alert" ). lumkisa ()

IMarkup

Yongeza data-dismiss="alert"nje kwiqhosha lakho lokuvala ukunika ngokuzenzekelayo umsebenzi okufutshane wesilumkiso.

  1. <a class = "close" data-dismiss = "alert" href = "#" > &amaxesha; </a>

Iindlela

$().isilumkiso()

Isonga zonke izilumkiso ngokusebenza ngokusondeleyo. Ukuze izilumkiso zakho ziphile xa zivaliwe, qiniseka ukuba zine .fadekwaye .inudidi sele lufakiwe kuzo.

.alert('vala')

Ivala isilumkiso.

  1. $ ( ".alert" ). lumkisa ( 'vala' )

Iziganeko

Iklasi yesilumkiso ye-Bootstrap iveza iminyhadala embalwa yokuqhagamshelwa ekusebenzeni kwesilumkiso.

Isiganeko Inkcazo
kufutshane Esi siganeko sivutha ngokukhawuleza xa closekubizwa indlela yomzekelo.
ivaliwe Esi siganeko sigxothwa xa isivuseleli sivaliwe (siya kulinda uguqulo lwe-css lugqibe).
  1. $ ( '#isilumkiso sam' ). bopha ( 'ivaliwe' , umsebenzi () {
  2. // Yenza into…
  3. })

Umzekelo wokusetyenziswa

Yenza ngakumbi ngamaqhosha. Iqhosha lokulawula lixela okanye wenze amaqela amaqhosha amalungu amaninzi njengebar yesixhobo.

Inyanisile

Yongeza data-loading-text="Loading..."ukusebenzisa imeko yokulayisha kwiqhosha.

  1. < uhlobo lweqhosha = "iqhosha" class = "btn btn-primary" data-loading-text = "Iyalayisha..." > Ilayisha imeko </iqhosha>

Uguqulelo olunye

Yongeza data-toggle="button"ukuze uvule iqhosha elinye.

  1. < uhlobo lweqhosha = "iqhosha" class = "btn btn-primary" data-toggle = "iqhosha" > Uguqulelo Olunye </ iqhosha>

Ibhokisi yokujonga

Yongeza data-toggle="buttons-checkbox"isimbo sebhokisi yokukhangela kwi-btn-iqela.

  1. <div class = "btn-group" data-toggle = "amaqhosha-checkbox" >
  2. < uhlobo lweqhosha = "iqhosha" iklasi = "btn btn-primary" > Ekhohlo </ iqhosha>
  3. < uhlobo lweqhosha = "iqhosha" iklasi = "btn btn-primary" > Phakathi </iqhosha>
  4. < uhlobo lweqhosha = "iqhosha" iklasi = "btn btn-primary" > Ekunene </ iqhosha>
  5. </ div>

Unomathotholo

Yongeza data-toggle="buttons-radio"kwisitayile sikanomathotholo kwi-btn-iqela.

  1. <div class = "btn-group" data-toggle = "amaqhosha-radio" >
  2. < uhlobo lweqhosha = "iqhosha" iklasi = "btn btn-primary" > Ekhohlo </ iqhosha>
  3. < uhlobo lweqhosha = "iqhosha" iklasi = "btn btn-primary" > Phakathi </iqhosha>
  4. < uhlobo lweqhosha = "iqhosha" iklasi = "btn btn-primary" > Ekunene </ iqhosha>
  5. </ div>

Ukusetyenziswa

Vula amaqhosha ngeJavaScript:

  1. $ ( '.nav-tabs' ). iqhosha ()

IMarkup

Iimpawu zedatha zibalulekile kwiplagi yeqhosha. Jonga umzekelo wekhowudi engezantsi kwiindidi ezahlukeneyo zokuphawula.

Iinketho

Akukho nanye

Iindlela

$().iqhosha('tshintsha')

Itshintsha imeko yokutyhala. Inika iqhosha inkangeleko yokuba livuliwe.

Iintloko phezulu! Unokwenza uguqulelo oluzenzekelayo lweqhosha ngokusebenzisa data-toggleuphawu.
  1. < uhlobo lweqhosha = "iqhosha" class = "btn" data-toggle = "iqhosha" > </iqhosha>

$().iqhosha('iyalayisha')

Icwangcisa imeko yeqhosha kulayisho - licima iqhosha kwaye utshintshise okubhaliweyo kukulayisha okubhaliweyo. Ukulayisha okubhaliweyo kufuneka kuchazwe kwiqhosha kusetyenziswa uphawu loyelelwano lwedatha data-loading-text.

  1. < uhlobo lweqhosha = "iqhosha" class = "btn" data-loading-text = "ukulayisha izinto..." > ... </iqhosha>
Iintloko phezulu! IFirefox iyaqhubeleka nemeko yokukhubazeka kuyo yonke imithwalo yamaphepha . Isisombululo sale nto kukusetyenziswa autocomplete="off".

$().iqhosha('seta ngokutsha')

Seta kwakhona imeko yeqhosha-tshintshanisa umbhalo ukuya kumbhalo wokuqala.

$().iqhosha(umtya)

Seta kwakhona ubume beqhosha-tshintshanisa okubhaliweyo kuyo nayiphi na idatha echazwe kwimeko yokubhaliweyo.

  1. < uhlobo lweqhosha = "iqhosha" class = "btn" data-complete-text = "kugqityiwe!" > ... </ iqhosha>
  2. <script>
  3. $ ( '.btn' ). iqhosha ( 'gqiba' )
  4. </script>

Malunga

Fumana izitayile ezisisiseko kunye nenkxaso ebhetyebhetye kumacandelo aqengqelekayo anje ngeaccordion kunye nokuhamba.

* Ifuna iplagin yeTransitions ukuba ibandakanywe.

Umzekelo iaccordion

Sisebenzisa iplagin yokuwa, sakhe iwijethi yesitayile esilula se-accordion:

Anim pariatur cliche reprehenderit, enim eiusmod ubomi obuphezulu accamus terry richardson ad squid. 3 ingcuka inyanga officia aute, non cupidatat skateboard dolor brunch. Ilori yokutya iquinoa nesciunt laborum eiusmod. Brunch 3 ingcuka inyanga tempor, sunt aliqua ubeke intaka kuyo iskwidi enye-imvelaphi ikofu nulla imaginenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. I-Leggings occaecat yenza ibhiya yasefama-kuya-kwitafile, idenim ekrwada i-aesthetic synth nesciunt mhlawumbi awuzange uve ngabo accusamus labour ezinzileyo yeVHS.
Anim pariatur cliche reprehenderit, enim eiusmod ubomi obuphezulu accamus terry richardson ad squid. 3 ingcuka inyanga officia aute, non cupidatat skateboard dolor brunch. Ilori yokutya iquinoa nesciunt laborum eiusmod. Brunch 3 ingcuka inyanga tempor, sunt aliqua ubeke intaka kuyo iskwidi enye-imvelaphi ikofu nulla imaginenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. I-Leggings occaecat yenza ibhiya yasefama-kuya-kwitafile, idenim ekrwada i-aesthetic synth nesciunt mhlawumbi awuzange uve ngabo accusamus labour ezinzileyo yeVHS.
Anim pariatur cliche reprehenderit, enim eiusmod ubomi obuphezulu accamus terry richardson ad squid. 3 ingcuka inyanga officia aute, non cupidatat skateboard dolor brunch. Ilori yokutya iquinoa nesciunt laborum eiusmod. Brunch 3 ingcuka inyanga tempor, sunt aliqua ubeke intaka kuyo iskwidi enye-imvelaphi ikofu nulla imaginenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. I-Leggings occaecat yenza ibhiya yasefama-kuya-kwitafile, idenim ekrwada i-aesthetic synth nesciunt mhlawumbi awuzange uve ngabo accusamus labour ezinzileyo yeVHS.
  1. <div class = "accordion" id = "accordion2" >
  2. <div iklasi = "i-accordion-iqela" >
  3. <div class = "i-accordion-heading" >
  4. <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseOne"> _
  5. Into yeQela egotywayo #1
  6. </a>
  7. </ div>
  8. <div id = "collapseOne" class = "accordion-body collapse in" >
  9. <div iklasi = "i-accordion-yangaphakathi" >
  10. Imifanekiso eshukumayo...
  11. </ div>
  12. </ div>
  13. </ div>
  14. <div iklasi = "i-accordion-iqela" >
  15. <div class = "i-accordion-heading" >
  16. <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseTwo" >
  17. Into yeQela egotywayo #2
  18. </a>
  19. </ div>
  20. <div id = "collapseTwo" iklasi = "i-accordion-body collapse" >
  21. <div iklasi = "i-accordion-yangaphakathi" >
  22. Imifanekiso eshukumayo...
  23. </ div>
  24. </ div>
  25. </ div>
  26. </ div>
  27. ...

Ungasebenzisa kwakhona iplagin ngaphandle kophawu lweaccordion. Yenza iqhosha ukuguqula ukwandisa kunye nokudilika kwenye into.

  1. < uhlobo lweqhosha = "iqhosha" class = "btn btn-danger" data-toggle = "collapse" data-target = "#demo" >
  2. elula eqengqelekayo
  3. </ iqhosha>
  4.  
  5. <div id = "idemo" iklasi = "ehla ngaphakathi" > </div>

Ukusetyenziswa

Ngeempawu zedatha

Yongeza nje data-toggle="collapse"kunye ne- data-targetelementi ukunika ngokuzenzekelayo ulawulo lwento eqengqelekayo. Uphawu data-targetloyelelwano lwamkela umkhethi we-css ukuze kufakwe ukutshitshiswa. Qinisekisa ukuba wongeza iklasi collapsekwinto 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.

NgeJavaScript

Vula ngesandla nge:

  1. $ ( ".collapse" ). Ukuwa ()

Iinketho

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

Iindlela

.ukuthoba(iinketho)

Yenza umxholo wakho ube yinto eqengqelekayo. Yamkela iinketho ozikhethelayo object.

  1. $ ( '#myCollapsible' ). ukuwa ({
  2. guqula : bubuxoki
  3. })

.thoba('tshintsha')

Iguqulela into eqengqelekayo ukuze iboniswe okanye ifihliwe.

.cotha('bonisa')

Ibonisa into eqengqelekayo.

.coqa('fihla')

Ifihla into eqengqelekayo.

Iziganeko

Iklasi yokuwa yeBootstrap iveza iminyhadala embalwa yokuhuka ekusebenzeni kokuwa.

Isiganeko Inkcazo
bonisa Esi siganeko sivutha ngokukhawuleza xa showkubizwa 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 hideindlela sele ibizwa.
efihliweyo Esi siganeko siyagxothwa xa into yokudilika ifihliwe kumsebenzisi (iya kulinda uguqulo lwecss ukuba lugqibe).
  1. $ ( '#myCollapsible' ). kwi ( 'ifihliwe' , umsebenzi () {
  2. // Yenza into…
  3. })

Umzekelo

I-plugin esisiseko, eyandisiweyo ngokulula yokwenza ngokukhawuleza iintloko zokuchwetheza ezintle ngalo naluphi na uhlobo lokufakwa kombhalo.

  1. <input type = "text" data-provide = "typeahead" >

Uya kufuna ukuseta autocomplete="off"ukunqanda iimenu zesikhangeli esingagqibekanga ukuba zivele ngaphezulu koluhlu lwe-Bootstrap yokuchwetheza.


Ukusetyenziswa

Ngeempawu zedatha

Yongeza iimpawu zedatha ukubhalisa into enomsebenzi wokuchwetheza njengoko kubonisiwe kumzekelo ongasentla.

NgeJavaScript

Fowunela i-typeahead ngesandla nge:

  1. $ ( '.typeahead' ). umphambili wokuchwetheza ()

Iinketho

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, queryixabiso kwindawo yongeniso kunye ne- processcallback. Umsebenzi unokusetyenziswa ngongqamaniso ngokubuyisela imvelaphi yedata ngokuthe ngqo okanye processngokulinganayo 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, itemapho kuvavanywa umbuzo. Fikelela kumbuzo wangoku nge this.query. Buyisela i-boolean trueukuba umbuzo uhambelana.
umhleli umsebenzi ukuhambelana ngqo,
uvakalelo
lwetyala, ukungakhathali
Indlela esetyenzisiweyo ukulungisa iziphumo ezizenzekelayo. Yamkela ingxoxo enye itemskwaye inomda womzekelo wokuchwetheza. Jonga umbuzo wangoku nge this.query.
umhlaziyi umsebenzi ibuyisela into ekhethiweyo Indlela esetyenzisiweyo ukubuyisela into ekhethiweyo. Yamkela ingxoxo enye, itemkwaye inomda womzekelo wokuchwetheza.
i-highlighter umsebenzi iqaqambisa zonke iimatshisi ezimiselweyo Indlela esetyenzisiweyo ukugqamisa iziphumo zokugqibezela ngokuzenzekelayo. Yamkela ingxoxo enye itemkwaye inomda womzekelo wokuchwetheza. Kufuneka ibuyise i-html.

Iindlela

.chwetheza ngaphambili(iinketho)

Uqalisa igalelo nge-typeahead.

Umzekelo

Ukuhanjiswa ngasekhohlo yidemo ephilayo ye-affix plugin.


Ukusetyenziswa

Ngeempawu zedatha

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.

  1. <div data-spy = "affix" data-offset-top = "200" > ... </div>
Iintloko phezulu! Kuya kufuneka ulawule indawo yento ephiniweyo kunye nokuziphatha komzali wayo osondeleyo. Isikhundla silawulwa ngu affix, affix-top, kunye affix-bottom . Khumbula ukujonga umzali onokuwa xa i-affix ingena njengoko isusa umxholo kwindlela eqhelekileyo yephepha.

NgeJavaScript

Fowunela i-affix plugin usebenzisa iJavaScript:

  1. $ ( '#navbar' ). ncamathela ()

Iinketho

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).