JavaScript

Zana ibice bya Bootstrap mubuzima-ubungubu hamwe na plugin 13 yihariye ya jQuery.

Umutwe! Izi nyandiko ni iya v2.3.2, itagishyigikiwe kumugaragaro. Reba verisiyo yanyuma ya Bootstrap!

Umuntu ku giti cye cyangwa yakusanyijwe

Amacomeka arashobora gushyirwamo kugiti cye (nubwo bamwe basabwa kwishingikiriza), cyangwa byose icyarimwe. Byombi bootstrap.js na bootstrap.min.js irimo amacomeka yose muri dosiye imwe.

Ibiranga amakuru

Urashobora gukoresha amacomeka ya Bootstrap yose ukoresheje marike API utanditse umurongo umwe wa JavaScript. Nibikorwa bya mbere bya Bootstrap API kandi igomba kuba iyambere yawe mugihe ukoresheje plugin.

Ibyo byavuzwe, mubihe bimwe na bimwe birashobora kuba byiza kuzimya iyi mikorere. Kubwibyo, turatanga kandi ubushobozi bwo guhagarika amakuru yikiranga API muguhuza ibyabaye byose kumazina yumubiri yashyizwe hamwe na '' data-api'`. Ibi bisa nkibi:

  1. $ ( 'umubiri' ). kuzimya ( '.data-api' )

Ubundi, kugirango ugaragaze plugin yihariye, shyiramo gusa izina rya plugin nkumwanya wizina hamwe na data-api izina ryumwanya nkuyu:

  1. $ ( 'umubiri' ). kuzimya ( '.alert.data-api' )

Gahunda ya API

Turizera kandi ko ugomba gushobora gukoresha amacomeka yose ya Bootstrap ukoresheje JavaScript API. API rusange rusange ni imwe, uburyo bukurikirana, kandi igasubiza icyegeranyo cyakozwe.

  1. $ ( ".btn.danger" ). buto ( "guhinduranya" ). OngerahoClass ( "ibinure" )

Uburyo bwose bugomba kwemera ibintu bidahitamo ikintu, umugozi ugamije uburyo runaka, cyangwa ntakintu (gitangiza plugin hamwe nimyitwarire idasanzwe):

  1. $ ( "#myModal" ). modal () // yatangijwe nibisanzwe
  2. $ ( "#myModal" ). modal ({ clavier : ibinyoma }) // yatangijwe nta clavier
  3. $ ( "#myModal" ). modal ( 'kwerekana' ) // itangiza kandi itabaza kwerekana ako kanya

Buri plugin irerekana kandi ibyubaka byayo ku mutungo wa `Constructor` : $.fn.popover.Constructor. Niba ushaka kubona plugin runaka urugero, iyikure muburyo butaziguye : $('[rel=popover]').data('popover').

Nta makimbirane

Rimwe na rimwe, birakenewe gukoresha amacomeka ya Bootstrap hamwe nibindi UI. Muri ibi bihe, umwanya wizina urashobora guhura rimwe na rimwe. Niba ibi bibaye, urashobora guhamagara .noConflictkuri plugin wifuza guhindura agaciro ka.

  1. var bootstrapButton = $ . fn . buto . noConflict () // subiza $ .fn.ibuto kumurongo wagenwe mbere
  2. $ . fn . bootstrapBtn = bootstrapButton // tanga $ (). bootstrapBtn imikorere ya bootstrap

Ibyabaye

Bootstrap itanga ibintu byabigenewe kubikorwa byinshi bya plugin. Mubisanzwe, ibi biza muburyo butagira ingano kandi bwashize - aho infinitive (ex. show) Itangizwa mugitangira ibirori, kandi ifishi yacyo ya kera (ex. shown) Ni imbarutso yo kurangiza igikorwa.

Ibintu byose bitagira ingano bitanga gukumiraIbikorwa bisanzwe. Ibi bitanga ubushobozi bwo guhagarika ikorwa ryigikorwa mbere yuko gitangira.

  1. $ ( '#myModal' ). kuri ( 'kwerekana' , imikorere ( e ) {
  2. niba (! amakuru ) garuka e . gukumiraDefault () // ihagarika modal kwerekanwa
  3. })

Ibyerekeye inzibacyuho

Kubintu byoroshye byinzibacyuho, shyiramo bootstrap-inzibacyuho.js rimwe kuruhande rwizindi dosiye za JS. Niba ukoresha bootstrap.js yakozwe (cyangwa yagabanijwe) , nta mpamvu yo gushiramo ibi-birahari.

Koresha imanza

Ingero nke za plugin yinzibacyuho:

  • Kunyerera cyangwa gushira muburyo
  • Kuzimya
  • Kugabanuka
  • Kunyerera karuseli

Ingero

Moderi iroroshe, ariko iroroshye, ikiganiro kibaza hamwe nibikorwa byibuze bisabwa nibikorwa byubwenge.

Urugero ruhamye

Byahinduwe modal hamwe numutwe, umubiri, hamwe nibikorwa byumutwe.

  1. <div class = "modal guhisha fade" >
  2. <div class = "modal-umutwe" >
  3. <buto ubwoko = "buto" urwego = "gufunga" data-gusezerera = "modal" aria-uhishe = "ukuri" > & ibihe; </button>
  4. <h3> Umutwe wuburyo </h3>
  5. </div>
  6. <div class = "modal-umubiri" >
  7. <p> Umubiri umwe mwiza… </p>
  8. </div>
  9. <div class = "modal-footer" >
  10. <a href = "#" class = "btn"> Funga </a> _
  11. <a href = "#" class = "btn btn-primary"> Bika impinduka </a>
  12. </div>
  13. </div>

Kubaho

Hindura modal ukoresheje JavaScript ukanze buto hepfo. Bizanyerera kandi bishire hejuru yurupapuro.

  1. <! - Buto yo gukurura modal ->
  2. <a href = "#myModal" uruhare = "buto" class = "btn" data-toggle = "modal"> Gutangiza uburyo bwa demo </a>
  3.  
  4. <! - Modal ->
  5. <div id = "myModal" class = "modal guhisha fade" tabindex = "-1" uruhare = "ikiganiro" aria-labelledby = "myModalLabel" aria-yihishe = "ukuri" >
  6. <div class = "modal-umutwe" >
  7. <buto ubwoko = "buto" urwego = "gufunga" data-gusezerera = "modal" aria-uhishe = "ukuri" > × </button>
  8. <h3 id = "myModalLabel" > Umutwe wuburyo </h3>
  9. </div>
  10. <div class = "modal-umubiri" >
  11. <p> Umubiri umwe mwiza… </p>
  12. </div>
  13. <div class = "modal-footer" >
  14. <buto icyiciro = "btn" data-gusezerera = "modal" aria-yihishe = "ukuri" > Funga </button>
  15. <buto icyiciro = "btn btn-primaire" > Bika impinduka </button>
  16. </div>
  17. </div>

Ikoreshwa

Binyuze mu biranga amakuru

Kora modal utanditse JavaScript. Shyira data-toggle="modal"ku kintu kigenzura, nka buto, hamwe na data-target="#foo"cyangwa href="#foo"kugirango ugaragaze uburyo bwihariye bwo guhinduranya.

  1. <buto ubwoko = "buto" data-toggle = "modal" data-target = "#myModal" > Gutangiza modal </button>

Binyuze kuri JavaScript

Hamagara modal ifite id myModalifite umurongo umwe wa JavaScript:

  1. $ ( '#myModal' ). modal ( amahitamo )

Amahitamo

Amahitamo arashobora kunyuzwa kumurongo wamakuru cyangwa JavaScript. Kubiranga Ibyatanzwe, Ongeraho Ihitamo Izina Kuri data-, Nka Muri data-backdrop="".

Izina Ubwoko Mburabuzi ibisobanuro
Inyuma boolean ni ukuri Harimo modal-backdrop element. Ubundi, vuga statickuri backdrop idafunze modal kanda.
Mwandikisho boolean ni ukuri Gufunga modal mugihe urufunguzo rwo guhunga rukanda
kwerekana boolean ni ukuri Erekana modal mugihe yatangijwe.
kure inzira ibinyoma

Niba url ya kure yatanzwe, ibirimo bizashyirwa muburyo bwa jQuery loadhanyuma binjizwe muri .modal-body. Niba ukoresha data api, urashobora gukoresha ubundi buryo hrefkugirango ugaragaze inkomoko ya kure. Urugero rwibi rwerekanwe hepfo:

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

Uburyo

.modal (amahitamo)

Koresha ibikubiyemo nkibisanzwe. Emera amahitamo object.

  1. $ ( '#myModal' ). modal ({
  2. Mwandikisho : ibinyoma
  3. })

.modal ('guhinduranya')

Intoki ihinduranya modal.

  1. $ ( '#myModal' ). modal ( 'guhinduranya' )

.modal ('kwerekana')

Nintoki ifungura modal.

  1. $ ( '#myModal' ). modal ( 'kwerekana' )

.modal ('guhisha')

Nintoki ihishe modal.

  1. $ ( '#myModal' ). modal ( 'guhisha' )

Ibyabaye

Moderi ya Bootstrap yerekana ibintu bike byo guhuza ibikorwa.

Icyabaye Ibisobanuro
kwerekana Ibirori birasa ako kanya mugihe showurugero rwitwa.
yerekanwe Ibirori birukanwa mugihe modal yakozwe igaragara kubakoresha (izategereza ko css inzibacyuho zirangira).
kwihisha Ibi birori birahita bisohoka mugihe uburyo hidebwurugero bwahamagawe.
byihishe Ibirori birukanwa mugihe modal yarangije guhishwa kumukoresha (izategereza ko css inzibacyuho zirangira).
  1. $ ( '#myModal' ). kuri ( 'bihishe' , imikorere () {
  2. // Gira icyo ukora…
  3. })

Urugero muri navbar

Gucomeka kwa ScrollSpy nuguhita uvugurura intego za nav ukurikije umwanya wizingo. Kuzenguruka agace kari munsi ya navbar hanyuma urebe impinduka zikora. Ibitonyanga byamanuka bizagaragazwa kandi.

@fat

Ad leggings keytar, brunch id art ibirori dolor labore. Pitchfork yr enim lo-fi mbere yuko bagurisha qui. Tumblr umurima-kumeza uburenganzira bwamagare ibyo aribyo byose. Anim keffiyeh carles cardigan. Velit seitan mcsweeney ifoto yicyumba 3 impyisi ukwezi irure. Cosby swater lomo jean ikabutura, williamsburg hoodie minim qui ushobora kuba utarigeze ubyumva et cardigan kwizera ikigega culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, inguzanyo irony biodiesel keffiyeh artisan ullamco ingaruka.

@mdo

Veniam marfa ubwanwa bwa skateboard, adipisising fugiat velit pitchfork ubwanwa. Freegan ubwanwa aliqua cupidatat mcsweeney's vero. Cupidatat bane loko nisi, ea helvetica nulla carles. Tattooed cosby swater ikamyo y'ibiryo, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles imyitozo idahwitse quis gentrify. Brooklyn adipisising ubukorikori byeri vice keytar deserunt.

imwe

Occaecat commodo aliqua delectus. Fap craft inzoga deserunt skateboard ea. Lomo uburenganzira bwamagare adipisising banh mi, velit ea sunt urwego rukurikira locavore ikawa imwe ikomoka muri magna veniam. Ubuzima burebure id vinyl, echo parike ibisubizo quis aliquip banh mi pitchfork. Vero VHS est adipisising. Consectetur nisi DIY minim messenger umufuka. Cred ex in, irambye delectus consectetur fanny pack iphone.

bibiri

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 messenger umufuka marfa icyaricyo cyose cya delectus ikamyo. Sapiente synth id assnda. Lokavore sed helvetica cliche irony, inkuba ushobora kuba utarigeze uyumva ingaruka za hoodie gluten-yubusa lo-fi fap aliquip. Umurimo elit umwanya mbere yuko bagurisha, terry richardson proident brunch nesciunt quis cosby swater pariatur keffiyeh ut helvetica umunyabukorikori. Cardigan craft byeri seitan yiteguye gukora velit. VHS chambray laboris by'agateganyo veniam. Anim mollit minim commodo ullamco inkuba.


Ikoreshwa

Binyuze mu biranga amakuru

Kugirango byoroshye kongeramo imyitwarire ya scrollspy kumurongo wawe wo hejuru, gusa ongera kubintu ushaka kuneka data-spy="scroll"(cyane cyane iyi yaba umubiri) no data-target=".navbar"guhitamo nav yo gukoresha. Uzashaka gukoresha imizingo hamwe nibigize .nav.

  1. <umubiri wumubiri -maneko = "umuzingo" data-intego = ".navbar" > ... </body>

Binyuze kuri JavaScript

Hamagara imizingo ukoresheje JavaScript:

  1. $ ( '#navbar' ). umuzingo ()
Umutwe! Imiyoboro ya Navbar igomba kuba ifite intego id idakemuka. Kurugero, <a href="#home">home</a>ugomba guhuza ikintu muri dom nka <div id="home"></div>.

Uburyo

.scrolllspy ('kugarura')

Mugihe ukoresheje umuzingo ufatanije no kongera cyangwa gukuraho ibintu muri DOM, uzakenera guhamagara uburyo bushya nka gutya:

  1. $ ( '[data-maneko = "umuzingo"]' ). buri ( imikorere () {
  2. var $ maneko = $ ( iyi ). umuzingo ( 'kugarura' )
  3. });

Amahitamo

Amahitamo arashobora kunyuzwa kumurongo wamakuru cyangwa JavaScript. Kubiranga Ibyatanzwe, Ongeraho Ihitamo Izina Kuri data-, Nka Muri data-offset="".

Izina Ubwoko Mburabuzi ibisobanuro
offset umubare 10 Pixels kugirango uve hejuru iyo ubaze umwanya wumuzingo.

Ibyabaye

Icyabaye Ibisobanuro
gukora Ibirori birasa igihe cyose ikintu gishya gihinduwe na muzingo.

Urugero

Ongeraho byihuse, imbaraga za tab imikorere kugirango uhindurwe unyuze kumurongo wibirimo byaho, ndetse unyuze kumurongo.

Raw denim ushobora kuba utarigeze wumva ibya jean ikabutura Austin. Nesciunt tofu stumptown aliqua, retro synth master suku. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh inzozi zo gufata. Cosby swater eu banh mi, qui irure terry richardson ex squid. Aliquip umwanya wa saliviya cillum iphone. Seitan aliquip quis cardigan imyambaro yabanyamerika, 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.


Ikoreshwa

Gushoboza imbonerahamwe ya tabs ukoresheje JavaScript (buri tab igomba gukenera kugiti cye):

  1. $ ( '#myTab a' ). kanda ( imikorere ( e ) {
  2. e . gukumiraIbisanzwe ();
  3. $ ( iyi ). tab ( 'kwerekana' );
  4. })

Urashobora gukora ama tabs kugiti cye muburyo butandukanye:

  1. $ ( '#myTab a [href = "# umwirondoro"]' ). tab ( 'kwerekana' ); // Hitamo tab ukoresheje izina
  2. $ ( '#myTab a: ubanza' ). tab ( 'kwerekana' ); // Hitamo tab ya mbere
  3. $ ( '#myTab a: iheruka' ). tab ( 'kwerekana' ); // Hitamo tab ya nyuma
  4. $ ( '#myTab li: eq (2) a' ). tab ( 'kwerekana' ); // Hitamo tab ya gatatu (0-yerekana)

Markup

Urashobora gukora tab cyangwa ibinini bigenda utanditse JavaScript iyo ari yo yose ugaragaza gusa data-toggle="tab"cyangwa data-toggle="pill"kubintu. Ongeraho navhamwe nav-tabsnamasomo kuri tab ulbizashyira mubikorwa Bootstrap.

  1. <ul class = "nav nav-tabs" >
  2. <li> <a href = "#home" data-toggle = "tab"> Urugo </a> </li>
  3. <li> <a href = "#profile" data-toggle = "tab"> Umwirondoro </a> </li>
  4. <li> <a href = "#messages" data-toggle = "tab"> Ubutumwa </a> </li>
  5. <li> <a href = "#settings" data-toggle = "tab"> Igenamiterere </a> </li>
  6. </ul>

Uburyo

$ (). tab

Gukora tab element hamwe nibikoresho birimo. Tab igomba kuba ifite a data-targetcyangwa hrefigamije icyerekezo cya kontineri muri DOM.

  1. <ul class = "nav nav-tabs" id = "myTab" >
  2. <li urwego = "rukora" > <a href = "#home"> Urugo </a> </li>
  3. <li> <a href = "#profile"> Umwirondoro </a> </li>
  4. <li> <a href = "#messages"> Ubutumwa </a> </li>
  5. <li> <a href = "#settings"> Igenamiterere </a> </li>
  6. </ul>
  7.  
  8. <div class = "tab-ibirimo" >
  9. <div class = "tab-pane ikora" id = "urugo" > ... </div>
  10. <div class = "tab-pane" id = "umwirondoro" > ... </div>
  11. <div class = "tab-pane" id = "ubutumwa" > ... </div>
  12. <div class = "tab-pane" id = "igenamiterere" > ... </div>
  13. </div>
  14.  
  15. <Inyandiko
  16. $ ( imikorere () {
  17. $ ( '#myTab a: iheruka' ). tab ( 'kwerekana' );
  18. })
  19. </script>

Ibyabaye

Icyabaye Ibisobanuro
kwerekana Ibirori birasa kuri tab yerekana, ariko mbere yuko tab nshya yerekanwe. Koresha event.targetno event.relatedTargetgutondekanya tab ikora hamwe na tab yabanjirije gukora (niba ihari).
yerekanwe Ibirori birasa kuri tab yerekanwe nyuma ya tab yerekanwe. Koresha event.targetno event.relatedTargetgutondekanya tab ikora hamwe na tab yabanjirije gukora (niba ihari).
  1. $ ( 'a [data-toggle = "tab"]' ). kuri ( 'yerekanwe' , imikorere ( e ) {
  2. e . intego // tab ikora
  3. e . bifitanye isano Intego // tab ibanza
  4. })

Ingero

Ahumekewe na jQuery nziza cyane.ipipsy plugin yanditswe na Jason Frame; Ibikoresho ni verisiyo ivuguruye, idashingiye ku mashusho, koresha CSS3 kuri animasiyo, hamwe na data-ibiranga kubika inyito yaho.

Kubwimpamvu zimikorere, ibikoresho hamwe na popover data-apis bahisemo, bivuze ko ugomba kubitangiza wenyine .

Hisha hejuru yibi bikurikira kugirango urebe ibikoresho:

Ipantaro ifatanye urwego rukurikira keffiyeh birashoboka ko utigeze ubyumva. Ifoto icyumba cyogosha ubwanwa mbisi denim inyuguti ya vegan messenger umufuka stumptown. Umurima-kumeza seitan, mcsweeney's fixie irambye quinoa 8-biti byabanyamerika bafite terry richardson vinyl chambray. Ubwanwa bwatsitaye, abakarigani banh mi lomo inkuba. Tofu biodiesel williamsburg marfa, bane loko mcsweeney yoza vegan chambray. Umunyabukorikori rwose birasekeje icyaricyo cyose urufunguzo , scenester umurima-kumeza banksy Austin twitter ikora freegan inguzanyo mbisi denim inkomoko imwe ya kawa virusi.

Ibyerekezo bine

Ibikoresho mumatsinda yinjiza

Mugihe ukoresheje ibikoresho bya popovers hamwe na Bootstrap yinjiza amatsinda, ugomba gushyiraho container(inyandiko yanditse hepfo) kugirango wirinde ingaruka zitifuzwa.


Ikoreshwa

Koresha igikoresho ukoresheje JavaScript:

  1. $ ( '#Urugero' ). ibikoresho ( amahitamo )

Amahitamo

Amahitamo arashobora kunyuzwa kumurongo wamakuru cyangwa JavaScript. Kubiranga Ibyatanzwe, Ongeraho Ihitamo Izina Kuri data-, Nka Muri data-animation="".

Izina Ubwoko Mburabuzi ibisobanuro
animasiyo boolean ni ukuri Koresha css fade inzibacyuho kubikoresho
html boolean ibinyoma Shyiramo html mubikoresho. Niba ari ibinyoma, uburyo bwa jquery textbuzakoreshwa mugushyiramo ibiri muri dom. Koresha inyandiko niba uhangayikishijwe n'ibitero bya XSS.
gushyira umugozi | imikorere 'hejuru' uburyo bwo gushyira ibikoresho - hejuru | munsi | ibumoso | iburyo
uwatoranije umugozi ibinyoma Niba uwatoranije atanzwe, ibikoresho byibikoresho bizahabwa intego zerekanwe.
Umutwe umugozi | imikorere '' agaciro ka titre agaciro niba `titre` tag idahari
imbarutso umugozi 'hover yibanze' uburyo ibikoresho byifashishwa - kanda | hover | kwibanda | imfashanyigisho. Menya neza ko watsinze pass trigger mutliple, umwanya watandukanijwe, ubwoko bwa trigger.
gutinda umubare | ikintu 0

gutinda kwerekana no guhisha ibikoresho (ms) - ntabwo bikoreshwa muburyo bwintoki

Niba umubare watanzwe, gutinda gukoreshwa byombi guhisha / kwerekana

Imiterere yibintu ni:delay: { show: 500, hide: 100 }

kontineri umugozi | ibinyoma ibinyoma

Ongeraho ibikoresho byibikoresho runakacontainer: 'body'

Umutwe! Amahitamo kubikoresho byihariye birashobora gutondekwa hakoreshejwe ikoreshwa ryamakuru.

Markup

  1. <a href = "#" data-toggle = "tooltip" title = "ibikoresho bya mbere"> unyereke hejuru yanjye </a>

Uburyo

$ (). ibikoresho (amahitamo)

Ongeraho ibikoresho byifashishwa mugukusanya ibintu.

.ibikoresho ('kwerekana')

Yerekana igikoresho cyibikoresho.

  1. $ ( '#element' ). ibikoresho ( 'kwerekana' )

.ibikoresho ('guhisha')

Hisha igikoresho cyibikoresho.

  1. $ ( '#element' ). ibikoresho ( 'guhisha' )

.ibikoresho ('guhinduranya')

Kuzuza ibikoresho by'ibikoresho.

  1. $ ( '#element' ). ibikoresho ( 'toggle' )

.ibikoresho ('gusenya')

Hisha kandi usenye ibikoresho bya element.

  1. $ ( '#element' ). ibikoresho ( 'gusenya' )

Ingero

Ongeraho uduce duto twibirimo, nkibiri kuri iPad, kubintu byose byo guturamo amakuru yisumbuye. Hisha hejuru ya buto kugirango utere popover. Irasaba Tooltip gushyirwamo.

Imiterere ihagaze

Amahitamo ane arahari: hejuru, iburyo, hepfo, n'ibumoso.

Hejuru

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

Popover iburyo

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

Hasi

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

Popover ibumoso

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

Nta kimenyetso cyerekanwe nka popovers kiva muri JavaScript nibirimo datamubiranga.

Kubaho

Ibyerekezo bine


Ikoreshwa

Gushoboza popovers ukoresheje JavaScript:

  1. $ ( '#Urugero' ). popover ( amahitamo )

Amahitamo

Amahitamo arashobora kunyuzwa kumurongo wamakuru cyangwa JavaScript. Kubiranga Ibyatanzwe, Ongeraho Ihitamo Izina Kuri data-, Nka Muri data-animation="".

Izina Ubwoko Mburabuzi ibisobanuro
animasiyo boolean ni ukuri Koresha css fade inzibacyuho kubikoresho
html boolean ibinyoma Shyiramo html muri popover. Niba ari ibinyoma, uburyo bwa jquery textbuzakoreshwa mugushyiramo ibiri muri dom. Koresha inyandiko niba uhangayikishijwe n'ibitero bya XSS.
gushyira umugozi | imikorere 'iburyo' uburyo bwo gushyira popover - hejuru | munsi | ibumoso | iburyo
uwatoranije umugozi ibinyoma niba uwatoranije yatanzwe, ibikoresho byibikoresho bizahabwa intego zerekanwe
imbarutso umugozi 'kanda' uko popover ikurura - kanda | hover | kwibanda | imfashanyigisho
Umutwe umugozi | imikorere '' Mburabuzi Umutwe Agaciro niba `titre` ikiranga idahari
ibirimo umugozi | imikorere '' agaciro gasanzwe agaciro niba `data-ibirimo` ikiranga kidahari
gutinda umubare | ikintu 0

gutinda kwerekana no guhisha popover (ms) - ntabwo ikoreshwa muburyo bwintoki

Niba umubare watanzwe, gutinda gukoreshwa byombi guhisha / kwerekana

Imiterere yibintu ni:delay: { show: 500, hide: 100 }

kontineri umugozi | ibinyoma ibinyoma

Ongeraho popover kubintu runakacontainer: 'body'

Umutwe! Amahitamo kubantu kugiti cyabo arashobora gutondekwa muburyo bwo gukoresha amakuru yibiranga.

Markup

Kubwimpamvu zimikorere, Tooltip na Popover data-apis irahitamo. Niba ushaka kubikoresha gusa garagaza amahitamo.

Uburyo

$ (). popover (amahitamo)

Itangiza popovers yikintu cyo gukusanya.

.kwerekana ('kwerekana')

Kugaragaza ibintu popover.

  1. $ ( '#element' ). popover ( 'kwerekana' )

.kwerekana ('guhisha')

Hisha ibintu popover.

  1. $ ( '#element' ). popover ( 'guhisha' )

.kwerekana ('guhinduranya')

Kuzuza ibintu popover.

  1. $ ( '#element' ). popover ( 'guhinduranya' )

.kwerekana ('gusenya')

Hisha kandi usenye ikintu cya popover.

  1. $ ( '#element' ). popover ( 'gusenya' )

Urugero

Ongeraho imikorere yo kwirukana ubutumwa bwose bwamenyeshejwe hamwe niyi plugin.

Guacamole yera! Byiza kugenzura yo wenyine, ntabwo ureba neza cyane.

Yoo! Wabonye ikosa!

Hindura ibi n'ibi hanyuma ugerageze. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus yicara amet fermentum.

Fata iki gikorwa Cyangwa ukore ibi


Ikoreshwa

Emera kwirukana integuza ukoresheje JavaScript:

  1. $ ( ".alert" ). kuba maso ()

Markup

Gusa ongeraho data-dismiss="alert"kuri bouton yawe yegeranye kugirango uhite utanga integuza yimikorere.

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

Uburyo

$ (). Kumenyesha ()

Kuzuza ibisobanuro byose hamwe nibikorwa bya hafi. Kugirango imenyesha ryawe risohoke iyo rifunze, menya neza ko bafite icyiciro .fadehamwe .innicyiciro kimaze kubashyiraho.

.alert ('hafi')

Funga integuza.

  1. $ ( ".alert" ). kuba maso ( 'gufunga' )

Ibyabaye

Bootstrap yo kumenyesha ibyiciro byerekana ibintu bike byo guhuza ibikorwa.

Icyabaye Ibisobanuro
hafi Ibirori birasa ako kanya mugihe closeurugero rwitwa.
gufunga Ibirori birukanwa mugihe integuza yafunzwe (izategereza ko css inzibacyuho zirangira).
  1. $ ( '# my-alert' ). guhambira ( 'gufunga' , imikorere () {
  2. // Gira icyo ukora…
  3. })

Urugero rukoreshwa

Kora byinshi hamwe na buto. Kugenzura buto ivuga cyangwa gukora amatsinda ya buto kubindi bikoresho nkibikoresho.

Leta

Ongeraho data-loading-text="Loading..."kugirango ukoreshe ibintu biremereye kuri buto.

  1. <buto ubwoko = "buto" urwego = "btn btn-primaire" amakuru-yipakurura-inyandiko = "Gupakira ..." > Imiterere ya leta </button>

Guhindura umwe

Ongeraho data-toggle="button"kugirango utangire guhinduranya kuri buto imwe.

  1. <buto ubwoko = "buto" urwego = "btn btn-primaire" data-toggle = "buto" > Toggle imwe </button>

Agasanduku

Ongeraho data-toggle="buttons-checkbox"kugenzura agasanduku k'uburyo bwo guhinduranya kuri btn-itsinda.

  1. <div class = "btn-itsinda" data-toggle = "buto-igenzura" >
  2. <buto ubwoko = "buto" urwego = "btn btn-primaire" > Ibumoso </button>
  3. <buto ubwoko = "buto" urwego = "btn btn-primaire" > Hagati </button>
  4. <buto ubwoko = "buto" urwego = "btn btn-primaire" > Iburyo </button>
  5. </div>

Radiyo

Ongeraho data-toggle="buttons-radio"uburyo bwa radio ihindagurika kuri btn-itsinda.

  1. <div class = "btn-itsinda" data-toggle = "buto-radio" >
  2. <buto ubwoko = "buto" urwego = "btn btn-primaire" > Ibumoso </button>
  3. <buto ubwoko = "buto" urwego = "btn btn-primaire" > Hagati </button>
  4. <buto ubwoko = "buto" urwego = "btn btn-primaire" > Iburyo </button>
  5. </div>

Ikoreshwa

Gushoboza buto ukoresheje JavaScript:

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

Markup

Ibiranga amakuru nibyingenzi kuri buto plugin. Reba kurugero kode iri munsi yubwoko butandukanye.

Amahitamo

Nta na kimwe

Uburyo

$ (). buto ('guhinduranya')

Toggles gusunika leta. Itanga buto igaragara ko yakoreshejwe.

Umutwe! Urashobora gukora auto toggling ya buto ukoresheje data-toggleikiranga.
  1. <buto ubwoko = "buto" urwego = "btn" data-toggle = "buto" > </button>

$ (). buto ('gupakira')

Gushiraho buto ya reta kugirango yikore - guhagarika buto hanyuma uhinduranya inyandiko kumpapuro zipakurura. Gupakurura inyandiko bigomba gusobanurwa kuri buto yibintu ukoresheje ikiranga amakuru data-loading-text.

  1. <buto ubwoko = "buto" urwego = "btn" amakuru-yipakurura-inyandiko = "ibintu byo gupakira ..." > ... </button>
Umutwe! Firefox ikomeza leta yamugaye kurupapuro rwuzuye . Imikorere kuriyi ni ugukoresha autocomplete="off".

$ (). buto ('gusubiramo')

Kugarura buto leta - guhinduranya inyandiko kumyandiko yumwimerere.

$ (). buto (umugozi)

Kugarura buto ya leta - ihinduranya inyandiko kubintu byose byasobanuwe inyandiko.

  1. <buto ubwoko = "buto" urwego = "btn" amakuru-yuzuye-inyandiko = "yarangije!" > ... </button>
  2. <Inyandiko
  3. $ ( '.btn' ). buto ( 'byuzuye' )
  4. </script>

Ibyerekeye

Shakisha uburyo bwibanze nubufasha bworoshye kubintu bishobora gusenyuka nka bordion hamwe nogukora.

* Irasaba plugin yinzibacyuho gushyirwamo.

Urugero

Twifashishije plugin yo gusenyuka, twubatsemo widget yoroheje yuburyo bwa widget:

Anim pariatur cliche reprehenderit, enim eiusmod ubuzima bwo hejuru accusamus terry richardson ad squid. 3 impyisi ukwezi officia aute, non cupidatat skateboard dolor brunch. Ikamyo y'ibiryo quinoa nesciunt laborum eiusmod. Brunch 3 impyisi ukwezi kwigihe, sunt aliqua shyiramo inyoni kuri squid inkomoko imwe yikawa nulla assome shoreditch et. Nihil anim keffiyeh helvetica, ubukorikori bwinzoga labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat ubukorikori bwinzoga umurima-kumeza, mbisi denim aesthetic synth nesciunt ushobora kuba utarigeze wumva bavuga accusamus labore irambye VHS.
Anim pariatur cliche reprehenderit, enim eiusmod ubuzima bwo hejuru accusamus terry richardson ad squid. 3 impyisi ukwezi officia aute, non cupidatat skateboard dolor brunch. Ikamyo y'ibiryo quinoa nesciunt laborum eiusmod. Brunch 3 impyisi ukwezi kwigihe, sunt aliqua shyiramo inyoni kuri squid inkomoko imwe yikawa nulla assome shoreditch et. Nihil anim keffiyeh helvetica, ubukorikori bwinzoga labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat ubukorikori bwinzoga umurima-kumeza, mbisi denim aesthetic synth nesciunt ushobora kuba utarigeze wumva bavuga accusamus labore irambye VHS.
Anim pariatur cliche reprehenderit, enim eiusmod ubuzima bwo hejuru accusamus terry richardson ad squid. 3 impyisi ukwezi officia aute, non cupidatat skateboard dolor brunch. Ikamyo y'ibiryo quinoa nesciunt laborum eiusmod. Brunch 3 impyisi ukwezi kwigihe, sunt aliqua shyiramo inyoni kuri squid inkomoko imwe yikawa nulla assome shoreditch et. Nihil anim keffiyeh helvetica, ubukorikori bwinzoga labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat ubukorikori bwinzoga umurima-kumeza, mbisi denim aesthetic synth nesciunt ushobora kuba utarigeze wumva bavuga accusamus labore irambye VHS.
  1. <div class = "akabariro" id = "akayaga2" >
  2. <div class = "itsinda-ryitsinda" >
  3. <div class = "imitwe-yumutwe" >
  4. <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseOne"> _
  5. Itsinda rishobora gusenyuka Ingingo # 1
  6. </a>
  7. </div>
  8. <div id = "gusenyukaOne" icyiciro = "gusenyuka-umubiri muri" >
  9. <div class = "akabariro-imbere" >
  10. Anim pariatur cliche ...
  11. </div>
  12. </div>
  13. </div>
  14. <div class = "itsinda-ryitsinda" >
  15. <div class = "imitwe-yumutwe" >
  16. <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseTwo"> _
  17. Itsinda rishobora gusenyuka Ingingo # 2
  18. </a>
  19. </div>
  20. <div id = "gusenyukaTwo" icyiciro = "gusenyuka-umubiri-gusenyuka" >
  21. <div class = "akabariro-imbere" >
  22. Anim pariatur cliche ...
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. ...

Urashobora kandi gukoresha plugin nta marike ya marike. Kora buto kugirango uhindure kwaguka no gusenyuka kwikindi kintu.

  1. <buto ubwoko = "buto" urwego = "btn btn-akaga" data-toggle = "gusenyuka" data-target = "#demo" >
  2. byoroshye gusenyuka
  3. </button>
  4.  
  5. <div id = "demo" urwego = "gusenyuka muri" > </div>

Ikoreshwa

Binyuze mu biranga amakuru

Gusa ongeraho data-toggle="collapse"na a data-targetkubintu kugirango uhite ugenera kugenzura ikintu gishobora kugwa. Ikiranga data-targetcyemera css guhitamo kugirango akoreshe gusenyuka kuri. Wemeze kongeramo urwego collapsekubintu bishobora kugwa. Niba wifuza ko byafungura, ongeraho urwego rwinyongera in.

Kugirango wongere imiyoborere isa nitsinda rishinzwe kugenzura kugabanuka, ongeramo amakuru ikiranga data-parent="#selector". Reba kuri demo kugirango ubone ibi mubikorwa.

Binyuze kuri JavaScript

Gushoboza intoki hamwe na:

  1. $ ( ".gusenyuka" ). gusenyuka ()

Amahitamo

Amahitamo arashobora kunyuzwa kumurongo wamakuru cyangwa JavaScript. Kubiranga Ibyatanzwe, Ongeraho Ihitamo Izina Kuri data-, Nka Muri data-parent="".

Izina Ubwoko Mburabuzi ibisobanuro
umubyeyi uwatoranije ibinyoma Niba uwatoranije noneho ibintu byose bishobora gusenyuka munsi yumubyeyi wabigenewe bizafungwa mugihe iki kintu gishobora kugwa. (bisa nimyitwarire ya gakondo)
guhinduranya boolean ni ukuri Kuzuza ibintu bishobora kugwa kuri invocation

Uburyo

gusenyuka (amahitamo)

Koresha ibikubiyemo nkibintu bishobora gusenyuka. Emera amahitamo object.

  1. $ ( '#Collapsible' ). gusenyuka ({
  2. guhinduranya : ibinyoma
  3. })

gusenyuka ('guhinduranya')

Kuzuza ikintu gishobora kugwa kugirango cyerekanwe cyangwa cyihishe.

gusenyuka ('kwerekana')

Erekana ikintu gishobora kugwa.

gusenyuka ('guhisha')

Hisha ikintu gishobora kugwa.

Ibyabaye

Bootstrap yo gusenyuka ibyiciro byerekana ibintu bike byo guhuza ibikorwa.

Icyabaye Ibisobanuro
kwerekana Ibirori birasa ako kanya mugihe showurugero rwitwa.
yerekanwe Ibirori birukanwa mugihe ikintu cyo gusenyuka cyakozwe kigaragara kubakoresha (bizategereza ko css inzibacyuho zirangira).
kwihisha Iki gikorwa kirahita gihita iyo hideuburyo bwahamagawe.
byihishe Ibirori birukanwa mugihe ikintu cyo gusenyuka cyihishe kumukoresha (uzategereza ko css inzibacyuho zirangira).
  1. $ ( '#Collapsible' ). kuri ( 'bihishe' , imikorere () {
  2. // Gira icyo ukora…
  3. })

Urugero

A shingiro, byoroshye kwagura plugin yo gukora byihuse gukora imashini yimyandikire hamwe nuburyo ubwo aribwo bwose bwanditse.

  1. <iyinjiza ubwoko = "inyandiko" data-gutanga = "typeahead" >

Uzashaka gushiraho autocomplete="off"kugirango wirinde ibisanzwe mushakisha iboneka kugaragara hejuru ya Bootstrap yandika.


Ikoreshwa

Binyuze mu biranga amakuru

Ongeraho ibiranga amakuru kugirango wandike ikintu gifite imikorere ya typahead nkuko bigaragara murugero hejuru.

Binyuze kuri JavaScript

Hamagara imashini yandikishijwe intoki hamwe na:

  1. $ ( '.typeahead' ). Imyandikire ()

Amahitamo

Amahitamo arashobora kunyuzwa kumurongo wamakuru cyangwa JavaScript. Kubiranga Ibyatanzwe, Ongeraho Ihitamo Izina Kuri data-, Nka Muri data-source="".

Izina Ubwoko Mburabuzi ibisobanuro
isoko umurongo, imikorere [] Inkomoko yamakuru yo kubaza. Birashobora kuba umurongo wimirongo cyangwa imikorere. Igikorwa cyatsinzwe impaka ebyiri, queryagaciro mumwanya winjiza no processguhamagarwa. Imikorere irashobora gukoreshwa mugihe cyo gusubiza inkomoko yamakuru mu buryo butaziguye cyangwa idahwitse binyuze mu processguhamagarwa kwa kimwe.
ibintu umubare 8 Umubare ntarengwa wibintu byo kwerekana mumanuka.
Uburebure umubare 1 Uburebure bwinyuguti ntoya ikenewe mbere yo gukurura ibyifuzo byuzuye
matcher imikorere urubanza rutumva Uburyo bwakoreshejwe mukumenya niba ikibazo gihuye nikintu. Emera impaka imwe, itemirwanya kugerageza ikibazo. Shikira ikibazo kiriho hamwe this.query. Subiza boolean trueniba ikibazo gihuye.
sorter imikorere bihuye neza,
urubanza rworoshye,
urubanza rutumva
Uburyo bukoreshwa mugutondekanya ibisubizo byuzuye. Emera impaka imwe itemskandi ifite intera ya typahead urugero. Reba ikibazo kiriho hamwe this.query.
kuvugurura imikorere Garuka Ikintu cyatoranijwe Uburyo bwakoreshejwe mugusubiza ikintu cyatoranijwe. Emera impaka imwe, i itemkandi ifite urwego rwimyandikire.
urumuri imikorere Kugaragaza Byose Bidasanzwe Uburyo bukoreshwa mukugaragaza ibisubizo byuzuye. Emera impaka imwe itemkandi ifite intera ya typahead urugero. Ugomba gusubira html.

Uburyo

.ubwoko (amahitamo)

Itangiza icyinjijwe hamwe nimyandikire.

Urugero

Subnavigation ibumoso ni demo nzima ya plugin.


Ikoreshwa

Binyuze mu biranga amakuru

Kugirango byoroshye kongeramo imyitwarire ya affix kubintu byose, ongera gusa data-spy="affix"kubintu ushaka kuneka. Noneho koresha offsets kugirango usobanure igihe cyo guhinduranya pinning yikintu kuri no kuzimya.

  1. <div data-maneko = "umugereka" data-offset-top = "200" > ... </div>
Umutwe! Ugomba gucunga umwanya wikintu cyometse hamwe nimyitwarire yababyeyi bayo. Umwanya ugenzurwa na affix, affix-topna affix-bottom. Wibuke kugenzura kubabyeyi bashobora gusenyuka mugihe umugereka utangiye nkuko bivanaho ibintu mubisanzwe byurupapuro.

Binyuze kuri JavaScript

Hamagara plugin ya affix ukoresheje JavaScript:

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

Amahitamo

Amahitamo arashobora kunyuzwa kumurongo wamakuru cyangwa JavaScript. Kubiranga Ibyatanzwe, Ongeraho Ihitamo Izina Kuri data-, Nka Muri data-offset-top="200".

Izina Ubwoko Mburabuzi ibisobanuro
offset umubare | imikorere | ikintu 10 Pixels kugirango uve kuri ecran mugihe ubara umwanya wumuzingo. Niba umubare umwe watanzwe, offset izashyirwa mubikorwa byombi hejuru no ibumoso. Kumva icyerekezo kimwe, cyangwa offsets nyinshi zidasanzwe, gusa utange ikintu offset: { x: 10 }. Koresha imikorere mugihe ukeneye gutanga imbaraga zitanga offset (ingirakamaro kubishushanyo mbonera bisubiza).