JavaSkript fɔ di Baybul

Bring Bootstrap in kɔmpɔnɛnt dɛn to layf—naw wit 13 kɔstɔm jQuery plɔgin dɛn.

Hed dɛn de ɔp! Dɛn doks ya na fɔ v2.3.2, we nɔ ɔfishal sɔpɔt igen. Chek di laytst vɛshɔn fɔ Bootstrap!

Wan wan ɔ we dɛn dɔn kɔmpilayt

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.

Data atribyut dɛn

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:

  1. $ ( ‘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:

  1. $ ( ‘bɔdi’ ). ɔf ( '.alert.data-api' ) Di wan dɛn we de na di wɔl.

Programmetik API fɔ di wan dɛn we de wok

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.

  1. $ ( ".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):

  1. $ ( "#miModal" ). modal () // initialized wit difɔlt dɛn
  2. $ ( "#miModal" ). modal ({ keyboard : false }) // initializ wit nɔ kibɔd
  3. $ ( "#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').

Nɔ Kɔnflikt Nɔ De

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 .noConflictdi plɔgin we yu want fɔ gi bak di valyu fɔ.

  1. 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
  2. $ . fn we bin de . bootstrapBtn = bootstrapButton // gi $().bootstrapBtn di bootstrap funkshɔnaliti

Di tin dɛn we kin apin

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.

  1. $ ( '#miModal' ). on ( 'sho' , funkshɔn ( e ) {
  2. if (! data ) ritɔn e . preventDefault () // stɔp modal fɔ sho
  3. }) bin de.

Bɔt di chenj dɛn we de apin

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.

Yuz kes dɛn

Sɔm ɛgzampul dɛn bɔt di transishɔn plɔgin:

  • Slaydin ɔ fading insay modal dɛn
  • Fading aut tab dɛn
  • Fading out di alɛt dɛn
  • Slaydin karusel pan dɛn

Ɛgzampul dɛn

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.

Statik ɛgzampul

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.

  1. <div klas = "modal ayd fade" >
  2. <div klas = "modal-hɛda" >
  3. <bɔt tayp = "bɔt" klas = "klos" data-dismis = "modal" aria-hiden = "tru" > &tayms; </bɔtin>
  4. <h3> Modal hεda </h3>
  5. </div> fɔ di wan dɛn we de
  6. <div klas = "modal-bɔdi" >
  7. <p> Wan fayn bɔdi... </p>
  8. </div> fɔ di wan dɛn we de
  9. <div klas = "modal-fut" >
  10. <a href = "#" klas = "btn" > Klos </a>
  11. <a href = "#" klas = "btn btn-praymari" > Sev chenj dɛn </a>
  12. </div> fɔ di wan dɛn we de
  13. </div> fɔ di wan dɛn we de

Layf dɛmo

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.

  1. <!-- Bɔtin fɔ trig modal -->
  2. <a href = "#myModal" rol = "bɔt" klas = "btn" data-tɔgl = "modal" > Lanch dɛmo modal </a>
  3.  
  4. <!-- Modal --> fɔ di wan dɛn we de
  5. <div id = "miModal" klas = "modal ayd fade" tabindex = "-1" rol = "daylɔg" aria-lɛbul bay = "miModalLɛbul" aria-ayd = "tru" >
  6. <div klas = "modal-hɛda" >
  7. <bɔt tayp = "bɔt" klas = "klos" data-dismis = "modal" aria-hiden = "tru" > × </bɔt>
  8. <h3 id = "myModalLabel" > Mɔdal hεda </h3>
  9. </div> fɔ di wan dɛn we de
  10. <div klas = "modal-bɔdi" >
  11. <p> Wan fayn bɔdi... </p>
  12. </div> fɔ di wan dɛn we de
  13. <div klas = "modal-fut" >
  14. <bɔt klas = "btn" data-dismis = "modal" aria-ayd = "tru" > Klos </bɔt>
  15. <button class = "btn btn-primary" > Sev chenj dɛn </bɔtin>
  16. </div> fɔ di wan dɛn we de
  17. </div> fɔ di wan dɛn we de

Aw fɔ yuz am

Via data atribyut dɛn

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.

  1. <bɔtin tayp = "bɔtin" data-tɔgl = "modal" data-target = "#myModal" > Lanch modal </bɔtin>

Yu kin yuz JavaSkript fɔ yuz am

Kɔl wan modal wit id myModalwit wan layn na JavaSkript:

  1. $ ( '#miModal' ). modal ( opshɔn dɛn ) .

Di tin dɛn we yu kin pik fɔ du

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 staticfɔ 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 loadyuz ɛn dɛn go injɛkt am na di .modal-body. If yu de yuz di data api, yu kin yuz di hreftag ɔda we fɔ sho di rimot sɔs. Wan ɛgzampul bɔt dis de dɔŋ ya:

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

Di we aw dɛn de du am

.modal(opshɔn dɛn) .

Aktiv yu kɔntinyu as modal. Aksept wan opshɔnal opshɔn dɛn object.

  1. $ ( '#miModal' ). modal ({
  2. kibɔd : lay lay tɔk
  3. }) bin de.

.modal('tɔgl') .

Manually de toggle wan modal.

  1. $ ( '#miModal' ). modal ( ‘tɔgl’ ) .

.modal('sho') .

Manually de opin wan modal.

  1. $ ( '#miModal' ). modal ( ‘sho’ ) .

.modal('ayd') .

Manually de ayd wan modal.

  1. $ ( '#miModal' ). modal ( ‘ayd’ ) .

Di tin dɛn we kin apin

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 showinstans 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 hidedɛ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).
  1. $ ( '#miModal' ). on ( 'ayd' , fɛnshɔn () {
  2. // du sɔntin...
  3. }) bin de.

Ɛgzampul na navbar

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.

@bɔmp

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.

@mdo na @mdo

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.

wan

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.

tu

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


Aw fɔ yuz am

Via data atribyut dɛn

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 .navkɔmpɔnɛnt.

  1. <bɔdi data-spay = "skrol" data-target = ".navbar" > ... </bɔdi>

Yu kin yuz JavaSkript fɔ yuz am

Kɔl di skrol dɛn bay JavaSkript:

  1. $ ( '#navbar' na di wan dɛn we de yuz am ). skrol dɛn () .
Hed dɛn de ɔp! Navbar link dɛn fɔ gɛt id target dɛn we dɛn kin sɔlv. Fɔ ɛgzampul, a <a href="#home">home</a>fɔ kɔrɛkt to sɔntin we de na di dom lɛk <div id="home"></div>.

Di we aw dɛn de du am

.skrolspy('rifresh') .

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:

  1. $ ( '[data-spy="skrol"]' ). ɛni wan ( fɛnshɔn () { .
  2. var $spy = $ ( dis ). skrolspy ( ‘rifresh’ ) .
  3. });

Di tin dɛn we yu kin pik fɔ du

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.

Di tin dɛn we kin apin

Program Tɔk bɔt
aktivet fɔ wok Dis ivent de faya ɛnitɛm we di skrol spy mek nyu tin wok.

Ɛgzampul tab dɛn

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.


Aw fɔ yuz am

Enable tabable tabs via JavaScript (ɛni tab nid fɔ aktiv wan wan):

  1. $ ( '#miTab a' ). klik ( fonkshɔn ( e ) { .
  2. e . prɛventDifɔlt ();
  3. $ ( dis ). tab ( ‘sho’ );
  4. }) bin de.

Yu kin aktiv wan wan tab dɛn difrɛn we dɛn:

  1. $ ( '#miTab wan[href="#profayl"]' ). tab ( ‘sho’ ); // Selekt tab bay nem
  2. $ ( '#miTab a:fɔs' ). tab ( ‘sho’ ); // Selekt fɔs tab
  3. $ ( '#miTab a: las' ). tab ( ‘sho’ ); // Selekt las tab
  4. $ ( '# miTab li: eq (2) a' ). tab ( ‘sho’ ); // Selekt tɔd tab (0-indeks)

Mak-ap fɔ di tin dɛn we de apin

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-tabsklas dɛn to di tab ul, i go yuz di Bootstrap tab stayl.

  1. <ul klas = "nav nav-tab dɛn" >
  2. <li><a href = "#os" data-tɔgl = "tab" > Os </a></li>
  3. <li><a href = "#prɔfayl" data-tɔgl = "tab" > Profayl </a></li>
  4. <li><a href = "#mɛsej dɛn" data-tɔgl = "tab" > Mɛsej dɛn </a></li>
  5. <li><a href = "#sɛtin" data-tɔgl = "tab" > Sɛtin dɛn </a></li>
  6. </ul> fɔ di wan dɛn we de

Di we aw dɛn de du am

$().tab fɔ di wan dɛn

Aktiv wan tab ɛlimɛnt ɛn kɔntinyu kɔntena. Tab fɔ gɛt ɛni wan pan wan data-targetɔ wan hrefwe de tɔch wan kɔntena node na di DOM.

  1. <ul klas = "nav nav-tab" id = "miTab" >
  2. <li klas = "aktiv" ><a href = "#os" > Os </a></li>
  3. <li><a href = "#prɔfayl" > Profayl </a></li>
  4. <li><a href = "#mɛsej dɛn" > Mɛsej dɛn </a></li>
  5. <li><a href = "#sɛtin dɛn" > Sɛtin dɛn </a></li>
  6. </ul> fɔ di wan dɛn we de
  7.  
  8. <div klas = "tab-kɔntinɛnt" >
  9. <div klas = "tab-pan aktiv". id = "os" > ... </div>
  10. <div klas = "tab-pan" id = "prɔfayl" > ... </div>
  11. <div klas = "tab-pan" id = "mɛsej dɛn" > ... </div>
  12. <div klas = "tab-pan". id = "sɛtin dɛn" > ... </div>
  13. </div> fɔ di wan dɛn we de
  14.  
  15. <skript>
  16. $ ( 1 ) . fɛnshɔn () { .
  17. $ ( '#miTab a: las' ).tab ( ‘sho’ );
  18. }) bin de.
  19. </skript>

Di tin dɛn we kin apin

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.relatedTargetfɔ 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.relatedTargetfɔ tɔch di aktiv tab ɛn di aktiv tab we bin de bifo (if i de) rispɛktful wan.
  1. $ ( 'a[data-tɔgl="tab"]' ). on ( 'sho' , funkshɔn ( e ) {
  2. e . target // tab we dɛn dɔn aktiv
  3. e . relatedTarget // tab we bin de bifo
  4. }) bin de.

Ɛgzampul dɛn

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.

Fo dairekshɔn dɛn

Tultip dɛn na input grup dɛn

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.


Aw fɔ yuz am

Trig di tultip bay JavaSkript:

  1. $ ( '#ɛgzampul' ). tultip ( opshɔn dɛn ) .

Di tin dɛn we yu kin pik fɔ du

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

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ɛntcontainer: 'body'

Hed dɛn de ɔp! Opshɔn fɔ wan wan tultip dɛn kin ɔda we fɔ spɛsifa tru di yus fɔ data atribyut dɛn.

Mak-ap fɔ di tin dɛn we de apin

  1. <a href = "#" data-toggle = "tultip" taytul = "fɔs tultip" > hova oba mi </a>

Di we aw dɛn de du am

$().tultip(opshɔn dɛn)

Ataya wan tultip handla to wan ɛlimɛnt kɔlɛkshɔn.

.tultip('sho') .

Rivɛl wan ɛlimɛnt in tultip.

  1. $ ( '#ɛlimɛnt' ). tultip ( ‘sho’ ) .

.tultip('ayd') .

Ayd wan ɛlimɛnt in tultip.

  1. $ ( '#ɛlimɛnt' ). tultip ( ‘ayd’ ) .

.tultip('tɔgl')

Toggles wan element in tultip.

  1. $ ( '#ɛlimɛnt' ). tultip ( ‘tɔgl’ ) .

.tultip('destroy') .

Ayd ɛn pwɛl wan ɛlimɛnt in tultip.

  1. $ ( '#ɛlimɛnt' ). tultip ( ‘fɔ pwɛl’ ) .

Ɛgzampul dɛn

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 .

Statik popover we de na di wɔl

Fo opshɔn dɛn de: ɔp, rayt, dɔŋ, ɛn lɛft alaynɛd.

Popover na di top

Sed posuere konsectetur est na di lobortis. Aenean yu leo ​​quam. Pɛlɛntesk ɔrnare sem lasinia kwam venɛnatis vestibulum.

Popover rayt

Sed posuere konsectetur est na di lobortis. Aenean yu leo ​​quam. Pɛlɛntesk ɔrnare sem lasinia kwam venɛnatis vestibulum.

Popover na di bottom

Sed posuere konsectetur est na di lobortis. Aenean yu leo ​​quam. Pɛlɛntesk ɔrnare sem lasinia kwam venɛnatis vestibulum.

Popover bin kɔmɔt de

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

Layf dɛmo

Fo dairekshɔn dɛn


Aw fɔ yuz am

Enable popovers bay JavaSkript:

  1. $ ( '#ɛgzampul' ). popover ( opshɔn dɛn ) .

Di tin dɛn we yu kin pik fɔ du

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

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ɛntcontainer: 'body'

Hed dɛn de ɔp!Opshɔn fɔ wan wan popover dɛn kin ɔda we fɔ spɛsifa tru di yus fɔ data atribyut dɛn.

Mak-ap fɔ di tin dɛn we de apin

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.

Di we aw dɛn de du am

$().popover(opshɔn dɛn) .

Initializes popovers fɔ wan ɛlimɛnt kɔllɛkshɔn.

.popover('sho') .

Rivɛl wan ɛlimɛnt dɛn popover.

  1. $ ( '#ɛlimɛnt' ). popover ( ‘sho’ ) .

.popover('ayd') .

Ayd wan ɛlimɛnt dɛn popover.

  1. $ ( '#ɛlimɛnt' ). popover ( ‘ayd’ ) .

.popover('tɔgl') .

Toggles wan ɛlimɛnt dɛn popover.

  1. $ ( '#ɛlimɛnt' ). popover ( ‘tɔgl’ ) .

.popover('destroy') .

Ayd ɛn pwɛl wan ɛlimɛnt in popover.

  1. $ ( '#ɛlimɛnt' ). popover ( ‘fɔ pwɛl’ ) .

Ɛgzampul alɛt dɛn

Ad dismis funkshɔnaliti to ɔl di alɛt mɛsej dɛn wit dis plɔgin.

Oli guacamole! Best check yo self, yu no luk tu gud.

Oh snap! Yu get wan error!

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.

Tek dis akshɔn Ɔ du dis


Aw fɔ yuz am

Ɛnable fɔ dismis wan alɛt bay JavaSkript:

  1. $ ( ".alɛt" ). alɛrt () .

Mak-ap fɔ di tin dɛn we de apin

Jɔs ad data-dismiss="alert"to yu klos bɔtin fɔ gi yu wan alɛt klos funkshɔnaliti ɔtomɛtik wan.

  1. <a klas = "klos" data-dismiss = "alɛt" href = "#" > &tayms; </a> fɔ di wan dɛn we de

Di we aw dɛn de du am

$().alɛrt() .

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 .inklas we dɔn ɔlrɛdi aplay to dɛn.

.alert('klos') .

Klos wan alɛt.

  1. $ ( ".alɛt" ). alert ( ‘klos’ ) .

Di tin dɛn we kin apin

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 closeinstans 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).
  1. $ ( '#mi-alɛt' ). bind ( 'klos' , fɛnshɔn () {
  2. // du sɔntin...
  3. }) bin de.

Ɛgzampul we dɛn kin yuz

Du mɔ wit bɔtin dɛn. Kɔntrol bɔtin de tɔk ɔ mek grup dɛn fɔ bɔtin fɔ mɔ kɔmpɔnɛnt dɛn lɛk tulba dɛn.

Stetful wan

Ad data-loading-text="Loading..."fɔ yuz wan lod stet na wan bɔtin.

  1. <bɔt tayp = "bɔt" klas = "btn btn-praymari" data-lɔd-tɛks = "Lod..." > Lod stet </bɔt>

Single toggle we yu de yuz

Add data-toggle="button"fɔ aktiv di toggling pan wan singl bɔtin.

  1. <bɔt tayp = "bɔt" klas = "btn btn-praymari" data-tɔgl = "bɔt" > Singl Tɔgl </bɔt>

Chɛkbɔks

Add data-toggle="buttons-checkbox"fɔ chɛkbɔks stayl toggling pan btn-grup.

  1. <div klas = "btn-grup" data-tɔgl = "bɔt-chɛkbɔks" >
  2. <bɔtin tayp = "bɔtin" klas = "btn btn-praymari" > Lɛft </bɔtin>
  3. <bɔtin tayp = "bɔtin" klas = "btn btn-praymari" > Midul </bɔtin>
  4. <bɔtin tayp = "bɔtin" klas = "btn btn-praymari" > Rayt </bɔtin>
  5. </div> fɔ di wan dɛn we de

Redio

Add data-toggle="buttons-radio"fɔ redio stayl toggling na btn-grup.

  1. <div klas = "btn-grup" data-tɔgl = "bɔtin-redio" >
  2. <bɔtin tayp = "bɔtin" klas = "btn btn-praymari" > Lɛft </bɔtin>
  3. <bɔtin tayp = "bɔtin" klas = "btn btn-praymari" > Midul </bɔtin>
  4. <bɔtin tayp = "bɔtin" klas = "btn btn-praymari" > Rayt </bɔtin>
  5. </div> fɔ di wan dɛn we de

Aw fɔ yuz am

Ɛnable bɔtin dɛn bay JavaSkript:

  1. $ ( '.nav-tab dɛn' ). bɔtin () .

Mak-ap fɔ di tin dɛn we de apin

Data atribyut dɛn na impɔtant tin fɔ di bɔtin plɔgin. Chek di ɛgzampul kɔd we de dɔŋ fɔ di difrɛn kayn mak dɛn.

Di tin dɛn we yu kin pik fɔ du

Nɔn

Di we aw dɛn de du am

$().bɔtin('tɔgl')

Toggles push stet. Gi di bɔtin di we aw i tan lɛk se dɛn dɔn aktiv am.

Hed dɛn de ɔp! Yu kin ɛnabul ɔto toggling fɔ wan bɔtin bay we yu yuz di data-toggleatribyut.
  1. <bɔtin tayp = "bɔtin" klas = "btn" data-tɔgl = "bɔtin" > ... </bɔtin>

$().bɔtin('lod')

Set bɔtin stet to lod - disables bɔtin ɛn swap tɛks to lod tɛks. Lod tɛks fɔ difayn pan di bɔtin ɛlimɛnt yuz di data atribyut data-loading-text.

  1. <bɔtin tayp = "bɔtin" klas = "btn" data-lɔd-tɛks = "lɔd tin..." > ... </bɔtin>
Hed dɛn de ɔp! Fayafaks de kɔntinyu fɔ de di disabled stet akɔdin to di pej lod dɛn . Wan we fɔ sɔlv dis na fɔ yuz autocomplete="off".

$().bɔtin('riset')

Riset bɔtin stet - swap tɛks to ɔrijinal tɛks.

$().bɔtin(string) .

Riset bɔtin stet - swap tɛks to ɛni data difayn tɛks stet.

  1. <bɔtin tayp = "bɔt" klas = "btn" data-kɔmplit-tɛks = " dɔn!" > ... </bɔtin>
  2. <skript>
  3. $ ( '.btn' ) we de na di wɔl. bɔtin ( ‘kɔmplit’ ) .
  4. </skript>

Bɔt

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.

Ɛgzampul fɔ sho se di akodiɔn

Yuz di kollaps plɔgin, wi bil wan simpul akkɔdin stayl widget:

Anim pariatur cliche reprehenderit, enim eiusmod ay layf akusum teri richardson ad squid. 3 wulf mun officia aute, nɔ cupidat sketbɔd dolor brunch. Trak fɔ it quinoa nesciunt laborum eiusmod. Brunch 3 wulf mun tempor, sunt aliqua put wan bɔd pan am squid singl-ɔrijin kɔfi nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, kraft bia laboure wes anderson kred nesciunt sapiente ea proident. Ad vegan ekseptɔr butcher vays lomo. Leggings occaecat kraft bia fam-to-tebul, raw denim aesthetic synth nesciunt yu probabli nɔ yɛri bɔt dɛn accusamus labore sataynabul VHS.
Anim pariatur cliche reprehenderit, enim eiusmod ay layf akusum teri richardson ad squid. 3 wulf mun officia aute, nɔ cupidat sketbɔd dolor brunch. Trak fɔ it quinoa nesciunt laborum eiusmod. Brunch 3 wulf mun tempor, sunt aliqua put wan bɔd pan am squid singl-ɔrijin kɔfi nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, kraft bia laboure wes anderson kred nesciunt sapiente ea proident. Ad vegan ekseptɔr butcher vays lomo. Leggings occaecat kraft bia fam-to-tebul, raw denim aesthetic synth nesciunt yu probabli nɔ yɛri bɔt dɛn accusamus labore sataynabul VHS.
Anim pariatur cliche reprehenderit, enim eiusmod ay layf akusum teri richardson ad squid. 3 wulf mun officia aute, nɔ cupidat sketbɔd dolor brunch. Trak fɔ it quinoa nesciunt laborum eiusmod. Brunch 3 wulf mun tempor, sunt aliqua put wan bɔd pan am squid singl-ɔrijin kɔfi nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, kraft bia laboure wes anderson kred nesciunt sapiente ea proident. Ad vegan ekseptɔr butcher vays lomo. Leggings occaecat kraft bia fam-to-tebul, raw denim aesthetic synth nesciunt yu probabli nɔ yɛri bɔt dɛn accusamus labore sataynabul VHS.
  1. <div klas = "akɔdin" id = "akɔdin2" >
  2. <div klas = "akɔdin-grup" >
  3. <div klas = "akɔdin-hɛdin" >
  4. <a klas = "akɔdin-tɔgl" data-tɔgl = "kɔlaps" data-mama ɛn papa = "#akɔdin2" href = "#kɔlapsWan" >
  5. Grup Aytem #1 we yu kin kol
  6. </a> fɔ di wan dɛn we de
  7. </div> fɔ di wan dɛn we de
  8. <div id = "kollapsWan" klas = "akɔdin-bɔdi kollaps in" >
  9. <div klas = "akɔdin-ina" >
  10. Anim pariatur na di kliche...
  11. </div> fɔ di wan dɛn we de
  12. </div> fɔ di wan dɛn we de
  13. </div> fɔ di wan dɛn we de
  14. <div klas = "akɔdin-grup" >
  15. <div klas = "akɔdin-hɛdin" >
  16. <a klas = "akɔdin-tɔgl" data-tɔgl = "kɔlaps" data-mama ɛn papa = "#akɔdin2" href = "#kɔlapsTu" >
  17. Grup Aytem #2 we yu kin kol
  18. </a> fɔ di wan dɛn we de
  19. </div> fɔ di wan dɛn we de
  20. <div id = "kollapsTu" klas = "akkɔdin-bɔdi kollaps" >
  21. <div klas = "akɔdin-ina" >
  22. Anim pariatur na di kliche...
  23. </div> fɔ di wan dɛn we de
  24. </div> fɔ di wan dɛn we de
  25. </div> fɔ di wan dɛn we de
  26. </div> fɔ di wan dɛn we de
  27. ...

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.

  1. <bɔtin tayp = "bɔtin" klas = "btn btn-denja" data-tɔgl = "kɔlaps" data-target = "#demo" >
  2. simpul we pɔsin kin kɔlap
  3. </bɔtin>
  4.  
  5. <div id = "demo" klas = "kɔlaps insay" > ... </div>

Aw fɔ yuz am

Via data atribyut dɛn

Jɔs ad data-toggle="collapse"ɛn wan data-targetto ɛlimɛnt fɔ ɔtomɛtik asaynd kɔntrol fɔ wan kollapsbul ɛlimɛnt. Di data-targetatribyut aksept wan css sɛlɛktɔ fɔ aplay di kɔlaps to. Mek shɔ se yu ad di klas collapseto 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.

Yu kin yuz JavaSkript fɔ yuz am

Enable manually wit:

  1. $ ( ".kɔlaps" ). fɔdɔm () .

Di tin dɛn we yu kin pik fɔ du

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

Di we aw dɛn de du am

.kollaps(opshɔn dɛn) .

Aktiv yu kɔntinyu as wan ɛlimɛnt we pɔsin kin kɔlap. Aksept wan opshɔnal opshɔn dɛn object.

  1. $ ( '#mi Kɔlapsibl' ). kollaps ({
  2. toggle : na lay lay tɔk
  3. }) bin de.

.kollaps('tɔgl') .

Toggles wan kollapsibl elemɛnt fɔ sho ɔ ayd.

.kollaps('sho') .

Sho wan ɛlimɛnt we pɔsin kin kɔlap.

.kollaps('ayd') .

I de ayd wan ɛlimɛnt we pɔsin kin kɔlap.

Di tin dɛn we kin apin

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 showinstans 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 hidedɛ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).
  1. $ ( '#mi Kɔlapsibl' ). on ( 'ayd' , fɛnshɔn () {
  2. // du sɔntin...
  3. }) bin de.

Ɛgzampul

Wan besik, izi fɔ ɛkstɛnd plɔgin fɔ mek kwik kwik wan elegant tayp-hɛd wit ɛni fɔm tɛks input.

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


Aw fɔ yuz am

Via data atribyut dɛn

Ad data atribyut fɔ rɛjista wan ɛlimɛnt wit typeahead funkshɔnaliti lɛk aw dɛn sho na di ɛgzampul ɔp.

Yu kin yuz JavaSkript fɔ yuz am

Kɔl di typeahead wit yu an wit:

  1. $ ( '.tayp bifo' ). tayp bifo () .

Di tin dɛn we yu kin pik fɔ du

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 queryvalyu na di input fil ɛn di processkɔ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 processkɔ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 itemagens 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 trueif 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.

Di we aw dɛn de du am

.typeahead(opshɔn dɛn) .

Initialize wan input wit wan typeahead.

Ɛgzampul

Di sabnavigishɔn na di lɛft na layv dɛmo fɔ di afiks plɔgin.


Aw fɔ yuz am

Via data atribyut dɛn

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.

  1. <div data-spy = "afiks" data-ɔfset-tɔp = "200" > ... </div>
Hed dɛn de ɔp! Yu fɔ de manej di pozishɔn fɔ wan ɛlimɛnt we dɛn dɔn pin ɛn di we aw in mama ɛn papa we de nia am de biev. affixNa , 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.

Yu kin yuz JavaSkript fɔ yuz am

Kɔl di afiks plɔgin bay JavaSkript:

  1. $ ( '#navbar' na di wan dɛn we de yuz am ). afiks () .

Di tin dɛn we yu kin pik fɔ du

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