Bring Bootstrap in kɔmpɔnɛnt dɛn to layf—naw wit 13 kɔstɔm jQuery plɔgin dɛn.
Yu kin put di plɔgin dɛn wan bay wan (pan ɔl we sɔm dɛn dɔn nid fɔ dipen pan dɛn), ɔ ɔl wan tɛm. Ɔl tu di bootstrap.js ɛn bootstrap.min.js gɛt ɔl di plɔgin dɛn na wan fayl.
Yu kin yuz ɔl di Bootstrap plɔgin dɛn jɔs tru di mak API we yu nɔ rayt wan layn na JavaSkript. Dis na Bootstrap in fɔs klas API ɛn i fɔ bi yu fɔs tin fɔ tink bɔt we yu de yuz plɔgin.
Dat se, insay sɔm sityueshɔn dɛn i kin fayn fɔ ɔf dis wok. So, wi de gi bak di abiliti fɔ disable di data atribyut API bay we wi de unbind ɔl di ivintɛns dɛn na di bɔdi nemspɛs wit `'data-api'`. Dis luk lɛk dis:
- $ ( ‘bɔdi’ ). ɔf ( '.data-api' ) Di wan dɛn we de yuz am.
Ɔda we de fɔ du dat, fɔ tɔch wan patikyula plɔgin, jɔs put di plɔgin in nem as nemspɛs wit di data-api nemspɛs lɛk dis:
- $ ( ‘bɔdi’ ). ɔf ( '.alert.data-api' ) Di wan dɛn we de na di wɔl.
Wi biliv bak se yu fɔ ebul fɔ yuz ɔl di Bootstrap plɔgin dɛn jɔs tru di JavaSkript API. Ɔl di pɔblik API dɛn na wan, chenj we dɛn kin yuz fɔ du tin, ɛn dɛn kin gi bak di kɔleshiɔn we dɛn akt pan.
- $ ( ".btn.denja" ). bɔtin ( "tɔgl" ). adKlas ( "fat" ) .
Ɔl di we dɛn fɔ aksept wan opshɔnal opshɔn ɔbjɛkt, wan string we de tɔch wan patikyula we, ɔ natin (we de bigin wan plɔgin wit difɔlt bihayvya):
- $ ( "#miModal" ). modal () // initialized wit difɔlt dɛn
- $ ( "#miModal" ). modal ({ keyboard : false }) // initializ wit nɔ kibɔd
- $ ( "#miModal" ). modal ( 'sho' ) // initializes ɛn invok sho wantɛm wantɛm
Ɛni plɔgin de ɛksplɔz in raw kɔnstrɔkta bak pan wan `Kɔnstrɔkta` prɔpati: $.fn.popover.Constructor
. If yu want fɔ gɛt wan patikyula plɔgin instans, tek am dairekt frɔm wan ɛlimɛnt: $('[rel=popover]').data('popover')
.
Sɔntɛnde i nid fɔ yuz Bootstrap plɔgin dɛn wit ɔda UI fremwɔk dɛn. Insay dɛn kayn tin ya, nemspɛs kɔlishin kin apin wan wan tɛm. If dis apin, yu kin kɔl .noConflict
di plɔgin we yu want fɔ gi bak di valyu fɔ.
- var bootstrapBɔtin = $ . fn we bin de . bɔtin . noConflict () // ritɔn $.fn.button to valyu we dɛn bin dɔn asaynd bifo tɛm
- $ . fn we bin de . bootstrapBtn = bootstrapButton // gi $().bootstrapBtn di bootstrap funkshɔnaliti
Bootstrap de gi kɔstɔm ivin fɔ bɔku pan di plɔgin in yon akshɔn dɛn. Jɛnɛral wan, dɛn wan ya kin kam insay wan infinitiv ɛn past patisipul fɔm - usay di infinitiv (ex. show
) kin trig we wan ivin bigin, ɛn in past patisipul fɔm (ex. shown
) kin trig we wan akshɔn dɔn.
Ɔl di infinitiv ivin dɛn de gi preventDefault funkshɔnaliti. Dis de gi di abiliti fɔ stɔp di ɛgzikishɔn fɔ wan akshɔn bifo i bigin.
- $ ( '#miModal' ). on ( 'sho' , funkshɔn ( e ) {
- if (! data ) ritɔn e . preventDefault () // stɔp modal fɔ sho
- }) bin de.
Fɔ simpul transishɔn ifɛkt dɛn, inklud bootstrap-transition.js wan tɛm nia di ɔda JS fayl dɛn. If yu de yuz di kɔmpilayt (ɔ we dɛn dɔn smɔl) bootstrap.js , nid nɔ de fɔ put dis insay—i dɔn ɔlrɛdi de.
Sɔm ɛgzampul dɛn bɔt di transishɔn plɔgin:
Modal dɛn na strimlayn, bɔt fleksibul, dayalɔg prɔmpt dɛn wit di minimum rikwayd funkshɔnaliti ɛn smat difɔlt dɛn.
Wan modal we dɛn dɔn rɛnd wit hεda, bɔdi, ɛn sɛt fɔ akshɔn dɛn na di fut.
Wan fayn fayn bɔdi...
- <div klas = "modal ayd fade" >
- <div klas = "modal-hɛda" >
- <bɔt tayp = "bɔt" klas = "klos" data-dismis = "modal" aria-hiden = "tru" > &tayms; </bɔtin>
- <h3> Modal hεda </h3>
- </div> fɔ di wan dɛn we de
- <div klas = "modal-bɔdi" >
- <p> Wan fayn bɔdi... </p>
- </div> fɔ di wan dɛn we de
- <div klas = "modal-fut" >
- <a href = "#" klas = "btn" > Klos </a>
- <a href = "#" klas = "btn btn-praymari" > Sev chenj dɛn </a>
- </div> fɔ di wan dɛn we de
- </div> fɔ di wan dɛn we de
Toggle wan modal via JavaScript bay we yu klik di bɔtin we de dɔŋ. I go slayv dɔŋ ɛn fade insay frɔm di ɔp pat na di pej.
- <!-- Bɔtin fɔ trig modal -->
- <a href = "#myModal" rol = "bɔt" klas = "btn" data-tɔgl = "modal" > Lanch dɛmo modal </a>
- <!-- Modal --> fɔ di wan dɛn we de
- <div id = "miModal" klas = "modal ayd fade" tabindex = "-1" rol = "daylɔg" aria-lɛbul bay = "miModalLɛbul" aria-ayd = "tru" >
- <div klas = "modal-hɛda" >
- <bɔt tayp = "bɔt" klas = "klos" data-dismis = "modal" aria-hiden = "tru" > × </bɔt>
- <h3 id = "myModalLabel" > Mɔdal hεda </h3>
- </div> fɔ di wan dɛn we de
- <div klas = "modal-bɔdi" >
- <p> Wan fayn bɔdi... </p>
- </div> fɔ di wan dɛn we de
- <div klas = "modal-fut" >
- <bɔt klas = "btn" data-dismis = "modal" aria-ayd = "tru" > Klos </bɔt>
- <button class = "btn btn-primary" > Sev chenj dɛn </bɔtin>
- </div> fɔ di wan dɛn we de
- </div> fɔ di wan dɛn we de
Aktiv wan modal we nɔ rayt JavaSkript. Sɛt data-toggle="modal"
pan wan kɔntrol ɛlimɛnt, lɛk wan bɔtin, wit wan data-target="#foo"
ɔ href="#foo"
fɔ tɔch wan patikyula modal fɔ tɔgl.
- <bɔtin tayp = "bɔtin" data-tɔgl = "modal" data-target = "#myModal" > Lanch modal </bɔtin>
Kɔl wan modal wit id myModal
wit wan layn na JavaSkript:
- $ ( '#miModal' ). modal ( opshɔn dɛn ) .
Yu kin pas opshɔn dɛn bay we yu yuz data atribyut ɔ JavaSkript. Fɔ data atribyut dɛn, ad di opshɔn nem to data-
, lɛk insay data-backdrop=""
.
Nem | kayn | balans | tɔk bɔt |
---|---|---|---|
bakdrop fɔ de | boolean we dɛn kɔl | tru | Inklud wan modal-bakdrop ɛlimɛnt. Ɔda we de fɔ du dat, spɛsifa static fɔ wan bakdrop we nɔ de lɔk di modal we yu klik. |
kibɔd fɔ di kibɔd | boolean we dɛn kɔl | tru | Klos di modal we dɛn prɛs di ɛspɛk ki |
sho | boolean we dɛn kɔl | tru | Sho di modal we dɛn initialize. |
fa | rod | lay | If dɛn gi wan rimot url, dɛn go lod kɔntinyu bay di we aw jQuery de
|
Aktiv yu kɔntinyu as modal. Aksept wan opshɔnal opshɔn dɛn object
.
- $ ( '#miModal' ). modal ({
- kibɔd : lay lay tɔk
- }) bin de.
Manually de toggle wan modal.
- $ ( '#miModal' ). modal ( ‘tɔgl’ ) .
Manually de opin wan modal.
- $ ( '#miModal' ). modal ( ‘sho’ ) .
Manually de ayd wan modal.
- $ ( '#miModal' ). modal ( ‘ayd’ ) .
Bootstrap in modal klas de ɛksplɔz sɔm ivin dɛn fɔ huk insay modal funkshɔnaliti.
Program | Tɔk bɔt |
---|---|
sho | Dis ivent de faya wantɛm wantɛm we dɛn kɔl di show instans mɛtɔd. |
we dɛn sho | Dis ivent de faya we di modal dɔn mek visible to di yuza (go wet fɔ css transishɔn dɛn fɔ dɔn). |
ayd | Dis ivent de faya wantɛm wantɛm we hide dɛn dɔn kɔl di instans mɛtɔd. |
ayd | Dis ivent de faya we di modal dɔn dɔn fɔ ayd frɔm di yuza (go wet fɔ css transishɔn dɛn fɔ dɔn). |
- $ ( '#miModal' ). on ( 'ayd' , fɛnshɔn () {
- // du sɔntin...
- }) bin de.
Ad drɔp-dɔwn mɛnyu dɛn to klos to ɛnitin wit dis simpul plɔgin, lɛk di navbar, tab dɛn, ɛn pils dɛn.
Ad data-toggle="dropdown"
to link ɔ bɔtin fɔ chenj wan drɔp-dɔwn.
- <div klas = "drɔpdɔwn" >
- <a klas = "drɔpdɔwn-tɔgl" data-tɔgl = "drɔpdɔwn" href = "#" > Drɔpdɔwn trig </a>
- <ul klas = "drɔpdɔwn-mɛnyu" rol = "mɛnyu" aria-lɛbul bay = "dLɛbul" >
- ...
- </ul> fɔ di wan dɛn we de
- </div> fɔ di wan dɛn we de
Fɔ mek di URL dɛn nɔ pwɛl, yuz di data-target
atribyut instead fɔ href="#"
.
- <div klas = "drɔpdɔwn" >
- <a klas = "drɔpdɔwn-tɔgl" id = "dLabel" rol = "bɔt" data-tɔgl = "drɔpdɔwn" data-target = "#" href = "/pej.html" >
- Drɔpdɔwn
- <b klas = "kɛrɛt" ></b>
- </a> fɔ di wan dɛn we de
- <ul klas = "drɔpdɔwn-mɛnyu" rol = "mɛnyu" aria-lɛbul bay = "dLɛbul" >
- ...
- </ul> fɔ di wan dɛn we de
- </div> fɔ di wan dɛn we de
Kɔl di drɔpdɔwn dɛn bay JavaSkript:
- $ ( '.drɔpdɔwn-tɔgl' ). drɔp dɔŋ () .
Nɔn
Wan programmatik api fɔ toggling mɛnyu fɔ wan givɛn navbar ɔ tab nevigishɔn.
Di ScrollSpy plɔgin na fɔ ɔtomɛtik ɔpdet nav target dɛn bays pan skrol pozishɔn. Skrol di eria we de dɔŋ di navbar ɛn wach di aktif klas chenj. Di drɔpdɔwn sab aytem dɛn go aylayt bak.
Ad leggings keytar, brunch id art pati dolor labore. Pitchfork yr enim lo-fi bifo dem sold out qui. Tumblr fam-to-tebul baysikul rayt ɛnitin. Anim keffiyeh karles kardigan. Velit seitan mcsweeney in foto booth 3 wolf mun irure. Cosby sweta lomo jins shɔt, williamsburg hoodie minim qui yu probabli nɔ yɛri bɔt dɛn et kadigan trɔst fund culpa biodiesel wes anderson aesthetic. Nihil tatu accusamus, cred irony bayodizel keffiyeh artisan ullamco konsekvat.
Veniam marfa moustache sketbod, adipisicing fugiat velit pitchfork biad. Frigan biad aliqua cupidatat mcsweeney in vero. Cupidatat fo loko nisi, ea helvetika nula karles. Tattoo cosby sweta fud trak, mcsweeney in quis non frigan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetik eksasaiz quis gentrify. Bruklin adipisicing kraft bia vays keytar deserunt.
Occaecat komodo alikwa delektɔs. Fap kraft bia deserunt skateboard ea. Lomo baysikul rayt adipisicing banh mi, velit ea sunt nɛks lɛvɛl locavore singl-ɔrijin kɔfi in magna veniam. Haj layf id vinyl, eko pak konsekwat quis aliquip banh mi pitchfork. Vero VHS est adipisicing fɔ di wan dɛn we de yuz am. Konsectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus konsectetur fanny pak ifon.
In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
Keytar twee blog, culpa mesenja bag marfa wetin delektus fud trak. Sapiente sint id asumenda. Locavore sed helvetica cliche irony, thundercats yu probabli noh don yehri boht dem consequat hoodie gluten-fri lo-fi fap aliquip. Labore elit placeat bifo dɛn sɛl aut, terry richardson proident brunch nesciunt quis cosby sweta pariatur keffiyeh ut helvetica artisan. Cardigan kraft bia seitan redimade velit. VHS chambray laboris t ɛ m ɔ r v ɛ n ɛ m. Anim mollit minim komodo ullamco na di tendakat.
Fɔ ad skrolspi bihayvya izi wan to yu tɔpba nevigishɔn, jɔs ad data-spy="scroll"
to di ɛlimɛnt we yu want fɔ spay pan (mɔs tipikli dis go bi di bɔdi) ɛn data-target=".navbar"
fɔ pik us nav fɔ yuz. Yu go want fɔ yuz scrollspy wit wan .nav
kɔmpɔnɛnt.
- <bɔdi data-spay = "skrol" data-target = ".navbar" > ... </bɔdi>
Kɔl di skrol dɛn bay JavaSkript:
- $ ( '#navbar' na di wan dɛn we de yuz am ). skrol dɛn () .
<a href="#home">home</a>
fɔ kɔrɛkt to sɔntin we de na di dom lɛk
<div id="home"></div>
.
We yu de yuz scrollspy in kɔnjɔkt wit ad ɔ pul ɛlimɛnt dɛn frɔm di DOM, yu go nid fɔ kɔl di rifresh we lɛk so:
- $ ( '[data-spy="skrol"]' ). ɛni wan ( fɛnshɔn () { .
- var $spy = $ ( dis ). skrolspy ( ‘rifresh’ ) .
- });
Yu kin pas opshɔn dɛn bay we yu yuz data atribyut ɔ JavaSkript. Fɔ data atribyut dɛn, ad di opshɔn nem to data-
, lɛk insay data-offset=""
.
Nem | kayn | balans | tɔk bɔt |
---|---|---|---|
ɔfset | nɔmba | 10. Di wan dɛn we de | Piksɛl dɛn fɔ ɔfset frɔm ɔp we yu de kɔl di pozishɔn fɔ skrol. |
Program | Tɔk bɔt |
---|---|
aktivet fɔ wok | Dis ivent de faya ɛnitɛm we di skrol spy mek nyu tin wok. |
Ad kwik, dinamik tab funkshɔnaliti fɔ chenj tru pan dɛn fɔ lokal kɔntinyu, ivin tru drɔpdɔwn mɛnyu dɛn.
Raw denim yu probabli noh yehri boht dem jean shorts Austin. Nesciunt tofu stumptown aliqua, retro sint masta klin. Mustache kliche tempor, wiliamsbɔg karls vegan ɛlvɛtika. Reprehenderit butcher retro keffiyeh drim kat sint. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip plesat salvia cillum iphone. Seitan aliquip quis kardigan american klos, butcher voluptate nisi qui.
Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.
Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
Enable tabable tabs via JavaScript (ɛni tab nid fɔ aktiv wan wan):
- $ ( '#miTab a' ). klik ( fonkshɔn ( e ) { .
- e . prɛventDifɔlt ();
- $ ( dis ). tab ( ‘sho’ );
- }) bin de.
Yu kin aktiv wan wan tab dɛn difrɛn we dɛn:
- $ ( '#miTab wan[href="#profayl"]' ). tab ( ‘sho’ ); // Selekt tab bay nem
- $ ( '#miTab a:fɔs' ). tab ( ‘sho’ ); // Selekt fɔs tab
- $ ( '#miTab a: las' ). tab ( ‘sho’ ); // Selekt las tab
- $ ( '# miTab li: eq (2) a' ). tab ( ‘sho’ ); // Selekt tɔd tab (0-indeks)
Yu kin aktiv wan tab ɔ pil nevigishɔn we yu nɔ rayt ɛni JavaSkript bay we yu jɔs spɛsifa data-toggle="tab"
ɔ data-toggle="pill"
pan wan ɛlimɛnt. We yu ad di nav
ɛn nav-tabs
klas dɛn to di tab ul
, i go yuz di Bootstrap tab stayl.
- <ul klas = "nav nav-tab dɛn" >
- <li><a href = "#os" data-tɔgl = "tab" > Os </a></li>
- <li><a href = "#prɔfayl" data-tɔgl = "tab" > Profayl </a></li>
- <li><a href = "#mɛsej dɛn" data-tɔgl = "tab" > Mɛsej dɛn </a></li>
- <li><a href = "#sɛtin" data-tɔgl = "tab" > Sɛtin dɛn </a></li>
- </ul> fɔ di wan dɛn we de
Aktiv wan tab ɛlimɛnt ɛn kɔntinyu kɔntena. Tab fɔ gɛt ɛni wan pan wan data-target
ɔ wan href
we de tɔch wan kɔntena node na di DOM.
- <ul klas = "nav nav-tab" id = "miTab" >
- <li klas = "aktiv" ><a href = "#os" > Os </a></li>
- <li><a href = "#prɔfayl" > Profayl </a></li>
- <li><a href = "#mɛsej dɛn" > Mɛsej dɛn </a></li>
- <li><a href = "#sɛtin dɛn" > Sɛtin dɛn </a></li>
- </ul> fɔ di wan dɛn we de
- <div klas = "tab-kɔntinɛnt" >
- <div klas = "tab-pan aktiv". id = "os" > ... </div>
- <div klas = "tab-pan" id = "prɔfayl" > ... </div>
- <div klas = "tab-pan" id = "mɛsej dɛn" > ... </div>
- <div klas = "tab-pan". id = "sɛtin dɛn" > ... </div>
- </div> fɔ di wan dɛn we de
- <skript>
- $ ( 1 ) . fɛnshɔn () { .
- $ ( '#miTab a: las' ).tab ( ‘sho’ );
- }) bin de.
- </skript>
Program | Tɔk bɔt |
---|---|
sho | Dis ivent de faya pan tab sho, bɔt bifo dɛn dɔn sho di nyu tab. Yuz event.target ɛn event.relatedTarget fɔ tɔch di aktiv tab ɛn di aktiv tab we bin de bifo (if i de) rispɛktful wan. |
we dɛn sho | Dis ivent de faya pan tab sho afta dɛn dɔn sho wan tab. Yuz event.target ɛn event.relatedTarget fɔ tɔch di aktiv tab ɛn di aktiv tab we bin de bifo (if i de) rispɛktful wan. |
- $ ( 'a[data-tɔgl="tab"]' ). on ( 'sho' , funkshɔn ( e ) {
- e . target // tab we dɛn dɔn aktiv
- e . relatedTarget // tab we bin de bifo
- }) bin de.
Inspɛkt bay di fayn fayn jQuery.tipsy plɔgin we Jason Frame rayt; Tultip dɛn na ɔpdet vɛshɔn, we nɔ de abop pan pikchɔ dɛn, dɛn de yuz CSS3 fɔ animashɔn dɛn, ɛn data-atribyut dɛn fɔ lokal taytul stɔrɔj.
Fɔ pefɔmɛns rizin, di tultip ɛn popover data-apis na opt in, we min se yu fɔ initialize dɛn yusɛf .
Hova oba di link dɛn we de dɔŋ fɔ si tultip dɛn:
Tayt pant neks levul keffiyeh yu probabli no don yehri boht dem. Foto booth biad raw denim letterpress vegan messenger bag stumptown. Fam-to-tebul seitan, mcsweeney in fixie sataynabul quinoa 8-bit american apɛl gɛt wan tɛri richardson vaynil chambray. Beard stumptown, kardigan banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, fo loko mcsweeney in klin vegan chambray. A rili ironic artisan wetin keytar , scenester fam-to-tebul banksy Austin twita handle frigan cred raw denim singl-orijin kɔfi vayral.
We yu de yuz tultip ɛn popovers wit di Bootstrap input grup dɛn, yu go gɛt fɔ sɛt di container
(we dɛn rayt dɔŋ ya) opshɔn fɔ avɔyd sayd ɛfɛkt dɛn we yu nɔ want.
Trig di tultip bay JavaSkript:
- $ ( '#ɛgzampul' ). tultip ( opshɔn dɛn ) .
Yu kin pas opshɔn dɛn bay we yu yuz data atribyut ɔ JavaSkript. Fɔ data atribyut dɛn, ad di opshɔn nem to data-
, lɛk insay data-animation=""
.
Nem | kayn | balans | tɔk bɔt |
---|---|---|---|
animashɔn fɔ di pikchɔ dɛn | boolean we dɛn kɔl | tru | aplay wan css fade transishɔn to di tultip |
html | boolean we dɛn kɔl | lay | Put html insay di tultip. If na lay, text dɛn go yuz jquery in we fɔ put kɔntinyu insay di dom. Yuz tɛks if yu de wɔri bɔt XSS atak dɛn. |
ples fɔ put am | string fɔ di wan dɛn we de | wok | 'ɔp' | aw fɔ posishun di tultip - ɔp | dɔŋ ya | lɛft | rayt |
sɛlɛktɔ | rop | lay | If dɛn gi wan sɛlɛktɔ, dɛn go gi tultip ɔbjɛkt dɛn to di target dɛn we dɛn dɔn spɛsifa. |
taytul | string fɔ di wan dɛn we de | wok | '' . | difɔlt taytul valyu if `taytul` tag nɔ de |
stat | rop | 'hova fɔs'. | aw di tultip de trig - klik | hover fɔ di wan dɛn we de wok | fɔs fɔs | buk. Notis yu kes pas trig mutliple, spes separet, trig tayp. |
westɛm | nɔmba | tin | 0. Di wan dɛn we de | dilay fɔ sho ɛn ayd di tultip (ms) - nɔ de aplay to manual trig tayp If dɛn gi wan nɔmba, dɛn kin delay fɔ ɔl tu di ayd/sho Objekt strɔkchɔ na: |
kɔntena we dɛn kin put insay | string fɔ di wan dɛn we de | lay | lay | Apɛnd di tultip to wan patikyula ɛlimɛnt |
- <a href = "#" data-toggle = "tultip" taytul = "fɔs tultip" > hova oba mi </a>
Ataya wan tultip handla to wan ɛlimɛnt kɔlɛkshɔn.
Rivɛl wan ɛlimɛnt in tultip.
- $ ( '#ɛlimɛnt' ). tultip ( ‘sho’ ) .
Ayd wan ɛlimɛnt in tultip.
- $ ( '#ɛlimɛnt' ). tultip ( ‘ayd’ ) .
Toggles wan element in tultip.
- $ ( '#ɛlimɛnt' ). tultip ( ‘tɔgl’ ) .
Ayd ɛn pwɛl wan ɛlimɛnt in tultip.
- $ ( '#ɛlimɛnt' ). tultip ( ‘fɔ pwɛl’ ) .
Ad smɔl ɔvalayz dɛn fɔ kɔntinyu, lɛk di wan dɛn we de na di iPad, to ɛni ɛlimɛnt fɔ haus sɛkɔndari infɔmeshɔn. Hover ova di bɔtin fɔ trig di popover. I nid fɔ de insay di Tultip .
Fo opshɔn dɛn de: ɔp, rayt, dɔŋ, ɛn lɛft alaynɛd.
Sed posuere konsectetur est na di lobortis. Aenean yu leo quam. Pɛlɛntesk ɔrnare sem lasinia kwam venɛnatis vestibulum.
Sed posuere konsectetur est na di lobortis. Aenean yu leo quam. Pɛlɛntesk ɔrnare sem lasinia kwam venɛnatis vestibulum.
Sed posuere konsectetur est na di lobortis. Aenean yu leo quam. Pɛlɛntesk ɔrnare sem lasinia kwam venɛnatis vestibulum.
Sed posuere konsectetur est na di lobortis. Aenean yu leo quam. Pɛlɛntesk ɔrnare sem lasinia kwam venɛnatis vestibulum.
No mak we dɛn sho as popovers nɔ de we dɛn de jenarayz frɔm JavaSkript ɛn kɔntinyu insay wan data
atribyut.
Enable popovers bay JavaSkript:
- $ ( '#ɛgzampul' ). popover ( opshɔn dɛn ) .
Yu kin pas opshɔn dɛn bay we yu yuz data atribyut ɔ JavaSkript. Fɔ data atribyut dɛn, ad di opshɔn nem to data-
, lɛk insay data-animation=""
.
Nem | kayn | balans | tɔk bɔt |
---|---|---|---|
animashɔn fɔ di pikchɔ dɛn | boolean we dɛn kɔl | tru | aplay wan css fade transishɔn to di tultip |
html | boolean we dɛn kɔl | lay | Insert html insay di popover. If na lay, text dɛn go yuz jquery in we fɔ put kɔntinyu insay di dom. Yuz tɛks if yu de wɔri bɔt XSS atak dɛn. |
ples fɔ put am | string fɔ di wan dɛn we de | wok | 'rayt' | aw fɔ posishun di popover - top | dɔŋ ya | lɛft | rayt |
sɛlɛktɔ | rop | lay | if dɛn gi wan sɛlɛktɔ, dɛn go gi tultip ɔbjɛkt dɛn to di target dɛn we dɛn dɔn spɛsifa |
stat | rop | 'klik'. | aw popover de trig - klik | hover fɔ di wan dɛn we de wok | fɔs fɔs | buk |
taytul | string fɔ di wan dɛn we de | wok | '' . | difɔlt taytul valyu if `taytul` atribyut nɔ de |
satisfay | string fɔ di wan dɛn we de | wok | '' . | difɔlt kɔntinyu valyu if `data-kɔntinɛnt` atribyut nɔ de |
westɛm | nɔmba | tin | 0. Di wan dɛn we de | dilay fɔ sho ɛn ayd di popover (ms) - nɔ de aplay to manual trigger type If dɛn gi wan nɔmba, dɛn kin delay fɔ ɔl tu di ayd/sho Objekt strɔkchɔ na: |
kɔntena we dɛn kin put insay | string fɔ di wan dɛn we de | lay | lay | Apɛnd di popover to wan patikyula ɛlimɛnt |
Fɔ pefɔmɛns rizin, di Tooltip ɛn Popover data-apis de opt in. If yu want fɔ yuz dɛn jɔs spɛsifa wan sɛlɛktɔ opshɔn.
Initializes popovers fɔ wan ɛlimɛnt kɔllɛkshɔn.
Rivɛl wan ɛlimɛnt dɛn popover.
- $ ( '#ɛlimɛnt' ). popover ( ‘sho’ ) .
Ayd wan ɛlimɛnt dɛn popover.
- $ ( '#ɛlimɛnt' ). popover ( ‘ayd’ ) .
Toggles wan ɛlimɛnt dɛn popover.
- $ ( '#ɛlimɛnt' ). popover ( ‘tɔgl’ ) .
Ayd ɛn pwɛl wan ɛlimɛnt in popover.
- $ ( '#ɛlimɛnt' ). popover ( ‘fɔ pwɛl’ ) .
Ad dismis funkshɔnaliti to ɔl di alɛt mɛsej dɛn wit dis plɔgin.
Chenj dis ɛn dat ɛn tray bak. Duis mollis, est non komodo luktus, nisi erat porttitor ligula, eget lasinia odio sem nec elit. Kras mattis konsektetur purus sidon amet fεmεnt.
Ɛnable fɔ dismis wan alɛt bay JavaSkript:
- $ ( ".alɛt" ). alɛrt () .
Jɔs ad data-dismiss="alert"
to yu klos bɔtin fɔ gi yu wan alɛt klos funkshɔnaliti ɔtomɛtik wan.
- <a klas = "klos" data-dismiss = "alɛt" href = "#" > &tayms; </a> fɔ di wan dɛn we de
Rap ɔl di alɛt dɛn wit klos funkshɔnaliti. Fɔ mek yu alɛt dɛn animate aut we dɛn lɔk, mek shɔ se dɛn gɛt di .fade
ɛn .in
klas we dɔn ɔlrɛdi aplay to dɛn.
Klos wan alɛt.
- $ ( ".alɛt" ). alert ( ‘klos’ ) .
Bootstrap in alɛt klas de ɛksplɔz sɔm ivintɛns fɔ huk insay alert funkshɔnaliti.
Program | Tɔk bɔt |
---|---|
tayt | Dis ivent de faya wantɛm wantɛm we dɛn kɔl di close instans mɛtɔd. |
dɛn dɔn lɔk am | Dis ivent de faya we di alert dɔn klos (go wet fɔ css transishɔn dɛn fɔ dɔn). |
- $ ( '#mi-alɛt' ). bind ( 'klos' , fɛnshɔn () {
- // du sɔntin...
- }) bin de.
Gɛt bays stayl ɛn fleksibul sɔpɔt fɔ kɔlapsibl kɔmpɔnɛnt dɛn lɛk akodiɔn ɛn nevigishɔn.
* I nid fɔ de insay di Transitions plɔgin.
Yuz di kollaps plɔgin, wi bil wan simpul akkɔdin stayl widget:
- <div klas = "akɔdin" id = "akɔdin2" >
- <div klas = "akɔdin-grup" >
- <div klas = "akɔdin-hɛdin" >
- <a klas = "akɔdin-tɔgl" data-tɔgl = "kɔlaps" data-mama ɛn papa = "#akɔdin2" href = "#kɔlapsWan" >
- Grup Aytem #1 we yu kin kol
- </a> fɔ di wan dɛn we de
- </div> fɔ di wan dɛn we de
- <div id = "kollapsWan" klas = "akɔdin-bɔdi kollaps in" >
- <div klas = "akɔdin-ina" >
- Anim pariatur na di kliche...
- </div> fɔ di wan dɛn we de
- </div> fɔ di wan dɛn we de
- </div> fɔ di wan dɛn we de
- <div klas = "akɔdin-grup" >
- <div klas = "akɔdin-hɛdin" >
- <a klas = "akɔdin-tɔgl" data-tɔgl = "kɔlaps" data-mama ɛn papa = "#akɔdin2" href = "#kɔlapsTu" >
- Grup Aytem #2 we yu kin kol
- </a> fɔ di wan dɛn we de
- </div> fɔ di wan dɛn we de
- <div id = "kollapsTu" klas = "akkɔdin-bɔdi kollaps" >
- <div klas = "akɔdin-ina" >
- Anim pariatur na di kliche...
- </div> fɔ di wan dɛn we de
- </div> fɔ di wan dɛn we de
- </div> fɔ di wan dɛn we de
- </div> fɔ di wan dɛn we de
- ...
Yu kin yuz di plɔgin bak we nɔ gɛt di akodin mak. Mek wan bɔtin tɔgl di ɛkspɛn ɛn kɔlapshɔn fɔ ɔda ɛlimɛnt.
- <bɔtin tayp = "bɔtin" klas = "btn btn-denja" data-tɔgl = "kɔlaps" data-target = "#demo" >
- simpul we pɔsin kin kɔlap
- </bɔtin>
- <div id = "demo" klas = "kɔlaps insay" > ... </div>
Jɔs ad data-toggle="collapse"
ɛn wan data-target
to ɛlimɛnt fɔ ɔtomɛtik asaynd kɔntrol fɔ wan kollapsbul ɛlimɛnt. Di data-target
atribyut aksept wan css sɛlɛktɔ fɔ aplay di kɔlaps to. Mek shɔ se yu ad di klas collapse
to di ɛlimɛnt we yu kin kɔlap. If yu want fɔ mek i opin difɔlt, ad di ɔda klas in
.
Fɔ ad grup manejmɛnt we tan lɛk akɔdiɔn to wan kɔntrol we pɔsin kin kɔl, ad di data atribyut data-parent="#selector"
. Rif to di demo fɔ si dis in akshɔn.
Enable manually wit:
- $ ( ".kɔlaps" ). fɔdɔm () .
Yu kin pas opshɔn dɛn bay we yu yuz data atribyut ɔ JavaSkript. Fɔ data atribyut dɛn, ad di opshɔn nem to data-
, lɛk insay data-parent=""
.
Nem | kayn | balans | tɔk bɔt |
---|---|---|---|
mama ɔ papa | sɛlɛktɔ | lay | If sɛlɛktɔ den ɔl di ɛlimɛnt dɛn we dɛn kin kɔl ɔnda di mama ɛn papa we dɛn dɔn spɛsifa go lɔk we dɛn sho dis tin we dɛn kin kol. (we fiba di tradishɔnal akɔdin we dɛn kin biev) |
fɔ chenj di we aw dɛn de | boolean we dɛn kɔl | tru | Toggles di kollapsibl elemɛnt pan invokeshɔn |
Aktiv yu kɔntinyu as wan ɛlimɛnt we pɔsin kin kɔlap. Aksept wan opshɔnal opshɔn dɛn object
.
- $ ( '#mi Kɔlapsibl' ). kollaps ({
- toggle : na lay lay tɔk
- }) bin de.
Toggles wan kollapsibl elemɛnt fɔ sho ɔ ayd.
Sho wan ɛlimɛnt we pɔsin kin kɔlap.
I de ayd wan ɛlimɛnt we pɔsin kin kɔlap.
Bootstrap in kollaps klas de ɛksplɔz sɔm ivintɛns fɔ huk insay kollaps funkshɔnaliti.
Program | Tɔk bɔt |
---|---|
sho | Dis ivent de faya wantɛm wantɛm we dɛn kɔl di show instans mɛtɔd. |
we dɛn sho | Dis ivent de faya we wan kollaps elemɛnt dɔn mek visible to di yuza (go wet fɔ css transishɔn dɛn fɔ dɔn). |
ayd | Dis ivent de faya wantɛm wantɛm we hide dɛn dɔn kɔl di we aw dɛn de du am. |
ayd | Dis ivent de faya we wan kollaps elemɛnt dɔn ayd frɔm di yuza (go wet fɔ css transishɔn dɛn fɔ dɔn). |
- $ ( '#mi Kɔlapsibl' ). on ( 'ayd' , fɛnshɔn () {
- // du sɔntin...
- }) bin de.
Di slayd sho we de dɔŋ ya de sho wan jenɛrik plɔgin ɛn kɔmpɔnɛnt fɔ sayklis tru ɛlimɛnt dɛn lɛk karusel.
- <div id = "miKarosel" klas = "karusel slayd" >
- <ol klas = "karusel-indikɛtɔ dɛn" >
- <li data-target = "#miKarosel" data-slayd-to = "0" klas = "aktiv" ></li>
- <li data-target = "#miKarosel" data-slayd-to = "1" ></li>
- <li data-target = "#miKarosel" data-slayd-to = "2" ></li>
- </ol>we de sho aw fɔ du dat
- <!-- Karusel tin dɛn -->
- <div klas = "karusel-ina" >
- <div klas = "aktiv aytem" > ... </div>
- <div klas = "aytem" > ... </div>
- <div klas = "aytem" > ... </div>
- </div> fɔ di wan dɛn we de
- <!-- Karusel nav -->
- <a klas = "karusel-kɔntrol lɛf" href = "#miKarosel" data-slayd = "prev" > ‹ </a> fɔ di wan dɛn we de
- <a klas = "karusel-kɔntrol rayt" href = "#miKarosel" data-slayd = "nɛks" > › </a> fɔ di wan dɛn we de
- </div> fɔ di wan dɛn we de
Yuz data atribyut fɔ izi fɔ kɔntrol di pozishɔn fɔ di karusel. data-slide
aksept di ki wɔd dɛn prev
ɔ next
, we de chenj di say we di slayd de rilitiv to di say we i de naw. Ɔda we de fɔ du dat, yuz data-slide-to
fɔ pas wan raw slayd indeks to di karusel data-slide-to="2"
, we de jomp na di slayd pozishɔn to wan patikyula indeks we bigin wit 0
.
Kɔl karusel wit yu an wit:
- $ ( '.karɔsel' ). karusel () ɛn .
Opshɔn dɛn kin pas bay data atribyut ɔ JavaScriptz. Fɔ data atribyut dɛn, ad di opshɔn nem to data-
, lɛk insay data-interval=""
.
Nem | kayn | balans | tɔk bɔt |
---|---|---|---|
intaval | nɔmba | 5000 pipul dɛn | Di amount of taim fɔ delay bitwin ɔtomɛtik sayklis wan tin. If na lay, karusel nɔ go ɔtomɛtik saykl. |
wet smɔl | rop | "hova" fɔ de. | Pauz di sayklis fɔ di karusel pan mawsɛnt ɛn bigin bak di sayklis fɔ di karusel pan mawslif. |
Initializes di carousel wit wan opshonal opshon object
en stat saikl tru tin dem.
- $ ( '.karɔsel' ). karɔsel ({
- intaval : 2000 na di ia
- }) bin de.
Saykl dɛn tru di karusel tin dɛn frɔm lɛft to rayt.
Stɔp di karusel fɔ sayklɔs tru tin dɛn.
Saykl di karusel to wan patikyula freym (0 bays, we fiba wan arenjmɛnt).
Saykl dɛn to di tin we bin dɔn de bifo.
Saykl dɛn to di nɛks tin.
Bootstrap in karusel klas de ɛksplɔz tu ivintɛns fɔ huk insay karusel funkshɔnaliti.
Program | Tɔk bɔt |
---|---|
sink | Dis ivent de faya wantɛm wantɛm we dɛn kɔl di slide instans mɛtɔd. |
bin slid | Dis ivent de faya we di karusel dɔn dɔn in slayd transishɔn. |
Wan besik, izi fɔ ɛkstɛnd plɔgin fɔ mek kwik kwik wan elegant tayp-hɛd wit ɛni fɔm tɛks input.
- <input tayp = "tɛks" data-provayd = "tayp bifo" >
Yu go want fɔ sɛt autocomplete="off"
fɔ mek di difɔlt brawza mɛnyu dɛn nɔ apia oba di Bootstrap typeahead drɔpdɔwn.
Ad data atribyut fɔ rɛjista wan ɛlimɛnt wit typeahead funkshɔnaliti lɛk aw dɛn sho na di ɛgzampul ɔp.
Kɔl di typeahead wit yu an wit:
- $ ( '.tayp bifo' ). tayp bifo () .
Yu kin pas opshɔn dɛn bay we yu yuz data atribyut ɔ JavaSkript. Fɔ data atribyut dɛn, ad di opshɔn nem to data-
, lɛk insay data-source=""
.
Nem | kayn | balans | tɔk bɔt |
---|---|---|---|
usay i kɔmɔt | arenjmɛnt, fɛnshɔn | [ ] . | Di data sɔs fɔ aks agens. I kin bi wan arenjmɛnt fɔ string dɛn ɔ wan fɛnshɔn. Di fɛnshɔn de pas tu argumɛnt, di query valyu na di input fil ɛn di process kɔl bak. Di fɛnshɔn kin yuz sinkron bay we dɛn de ritɔn di data sɔs dairekt ɔ asinkrɔn tru di process kɔlbak in singl argumɛnt. |
tin dɛn | nɔmba | 8. Di wan dɛn we de | Di maks nɔmba fɔ di tin dɛn we yu fɔ sho na di drɔpdɔwn. |
minLɛngth | nɔmba | 1. Di wan dɛn we de | Di minimum karakta lɔng we nid bifo dɛn trig ɔtokɔmplit sɔgzhɛshɔn dɛn |
di wan we de mach | wok | kes we nɔ gɛt sɛns | Di we aw dɛn kin yuz fɔ no if kwɛstyɔn de mach wan tin. Aksept wan argumɛnt, di item agens we fɔ tɛst di kwɛstyɔn. Akses di kwɛstyɔn we yu de aks naw wit this.query . Ritɔn wan bɔlin true if kwɛstyɔn na wan mach. |
sɔrt we de sɔt | wok | ɛksaktɔl mach, kes sɛnsitiv, kes nɔ sɛnsitiv |
Method we dɛn yuz fɔ sɔt ɔtokɔmplit rizɔlt dɛn. Aksept wan singl argumɛnt items ɛn gɛt di skɔp fɔ di typeahead instans. Rifrɛns di kwɛstyɔn we yu de aks naw wit this.query . |
ɔpdet fɔ di wan dɛn we de ɔpdet | wok | de gi bak di tin we yu dɔn pik | Di we aw dɛn kin yuz fɔ gi bak di tin we yu dɔn pik. Aksept wan singl argumɛnt, di item ɛn gɛt di skɔp fɔ di typeahead instans. |
di wan we de sho aw fɔ aylayt | wok | de sho ɔl di difɔlt mats dɛn | Method we dɛn yuz fɔ sho di ɔtokɔmplit rizɔlt dɛn. Aksept wan singl argumɛnt item ɛn gɛt di skɔp fɔ di typeahead instans. Fɔ ritɔn html. |
Initialize wan input wit wan typeahead.
Di sabnavigishɔn na di lɛft na layv dɛmo fɔ di afiks plɔgin.
Fɔ ad afiks bihayvya izi wan to ɛni ɛlimɛnt, jɔs ad data-spy="affix"
to di ɛlimɛnt we yu want fɔ spay pan. Dɔn yuz ɔfset fɔ difayn ustɛm fɔ tɔgl di pin fɔ wan ɛlimɛnt pan ɛn ɔf.
- <div data-spy = "afiks" data-ɔfset-tɔp = "200" > ... </div>
affix
Na ,
affix-top
, ɛn ,
de kɔntrol di pozishɔn
affix-bottom
. Mɛmba fɔ chɛk fɔ wan mama ɔ papa we go ebul fɔ kol we di afiks kik insay as i de pul kɔntinyu frɔm di nɔmal flɔ na di pej.
Kɔl di afiks plɔgin bay JavaSkript:
- $ ( '#navbar' na di wan dɛn we de yuz am ). afiks () .
Yu kin pas opshɔn dɛn bay we yu yuz data atribyut ɔ JavaSkript. Fɔ data atribyut dɛn, ad di opshɔn nem to data-
, lɛk insay data-offset-top="200"
.
Nem | kayn | balans | tɔk bɔt |
---|---|---|---|
ɔfset | nɔmba | funkshɔn | tin | 10. Di wan dɛn we de | Piksɛl dɛn fɔ ɔfset frɔm skrin we yu de kɔlkul di pozishɔn fɔ skrol. If dɛn gi wan nɔmba, dɛn go yuz di ɔfset na ɔl tu di say dɛn we de ɔp ɛn di lɛft. Fɔ lisin fɔ wan dairekshɔn, ɔ bɔku yunik ɔfset dɛn, jɔs gi wan tin offset: { x: 10 } . Yuz wan fɛnshɔn we yu nid fɔ dinamik wan fɔ gi wan ɔfset (yuzful fɔ sɔm rispɔnsiv dizayn dɛn). |