JavaScript ye

Bootstrap ka yɔrɔw lase ɲɛnamaya ma—sisan ni jQuery ka fɛn 13 ye minnu bɛ kɛ ka kɛɲɛ ni mɔgɔw sago ye.

Mɔgɔ kelen-kelen walima a lajɛlen

Pluginw bɛ Se ka Dòn u kelen-kelen na (hali n’a y’a Sɔrɔ dɔw ye dependencies (daɲɛw) wajibiya), walima u bɛɛ bɛ Se ka Dòn a la siɲɛ kelen. Bootstrap.js ni bootstrap.min.js fila bɛɛ bɛ 'plugin (dakun) bɛɛ Sɔrɔ filen kelen kɔnɔ.

Donanw ka fɛnw

I bɛ se ka baara kɛ ni Bootstrap plugins bɛɛ ye dɔrɔn markup API fɛ k’a sɔrɔ i ma JavaScript sɛrɛ kelen sɛbɛn. Nin ye Bootstrap ka API fɔlɔ ye wa a ka kan ka kɛ i ka jateminɛ fɔlɔ ye ni i bɛ baara kɛ ni plugin ye.

O fɔlen, ko dɔw la, a bɛ se ka kɛ ko a ka ɲi ka nin baarakɛcogo in faga. O la, an bɛ se fana Di ka data attribut API bali ni ko kɛlenw bɛɛ sirili ye farikolo tɔgɔdagalen kan ni `'data-api'` ye. Nin bɛ i n’a fɔ nin cogo in na:

  1. $ ( 'farikolo' ). off ( '.data-api' ) .

O cogo kelen na, walasa ka fɛn kɛrɛnkɛrɛnnen dɔ Laɲini, i bɛ fɛn in tɔgɔ Dòn dɔrɔn i n’a fɔ tɔgɔda-yɔrɔ ka Fàra data-api tɔgɔda-yɔrɔ kan i n’a fɔ nin:

  1. $ ( 'farikolo' ). off ( '.kɔlɔsili.data-api' ) .

API porogaramulen

An dalen b’a la fana ko i ka kan ka se ka baara kɛ ni Bootstrap plugins bɛɛ ye JavaScript API dɔrɔn fɛ. Foroba APIw bɛɛ ye fɛɛrɛ kelenw ye, minnu bɛ se ka siri ni cakɛda ye, ani ka segin dalajɛlen kan min waleyara.

  1. $ ( ".btn.farati" ). butɔni ( "toggle" ). addClass ( "fasa" ) .

Fɛɛrɛ bɛɛ ka kan ka sɔn sugandili fɛn dɔ ma, sɛrɛ min bɛ fɛɛrɛ kɛrɛnkɛrɛnnen dɔ laɲini, walima foyi tɛ (min bɛ fɛn dɔ daminɛ ni kɛcogo kɔrɔ ye):

  1. $ ( "#n ka Modal" ). modal () // daminɛ ni defaults ye
  2. $ ( "#n ka Modal" ). modal ({ klaviyeti : nkalon }) // daminɛna ni klaviyeti tɛ
  3. $ ( "#n ka Modal" ). modal ( 'show' ) // bɛ jirali daminɛ ani k'a wele o yɔrɔnin bɛɛ

Plugin kelen-kelen bɛɛ fana b’a ka raw constructor jira `Constructor` property kan: $.fn.popover.Constructor. N’i ​​b’a fɛ ka plugin instance kɛrɛnkɛrɛnnen dɔ sɔrɔ, i k’a sɔrɔ k’a ɲɛsin element dɔ ma: $('[rel=popover]').data('popover').

Kɛlɛ tɛ yen

Tuma dɔw la a ka kan ka baara kɛ ni Bootstrap plugins ye ni UI framework wɛrɛw ye. O cogoyaw la, tɔgɔda-yɔrɔ-ko bɛ Se ka Kɛ tuma dɔw la. N'o Kɛra, i bɛ Se ka weleli .noConflictKɛ i b'a fɛ ka min nafa Lasegin.

  1. var bootstrapButɔni = $ . fn ye . butɔni . noConflict () // segin $.fn.button ka nafa min dira ka kɔrɔ
  2. $ ye . fn ye . bootstrapBtn = bootstrapButton // ka $().bootstrapBtn di bootstrap baarakɛcogo ma

Ko minnu kɛra

Bootstrap bɛ ko kɛlenw di minnu bɛ kɛ ka kɛɲɛ ni mɔgɔw sago ye, ka ɲɛsin plugin ka wale kɛrɛnkɛrɛnnenw fanba ma. A ka c’a la, ninnu bɛ Nà daɲɛ-dafalen ni daɲɛ tɛmɛnen cogo la - daɲɛ-dafalen (ex. show) bɛ Daminɛ yɔrɔ min na ko dɔ daminɛ na, wa a daɲɛ tɛmɛnen cogoya (ex. shown) bɛ Daminɛ wale dɔ dafalen na.

Infinitif events bɛɛ bɛ preventDefault baarakɛcogo di. O bɛ se di ka wale dɔ waleyali jɔ sani a ka daminɛ.

  1. $ ( '#n ka Modal' ). kan ( 'jira' , baara ( e ) { .
  2. ni (! data ) segin e . preventDefault () // bɛ modal jirali dabila
  3. })

Tɛmɛsira ko la

Walasa ka tɛmɛsira nɔgɔmanw sɔrɔ, aw bɛ bootstrap-transition.js don siɲɛ kelen JS filen tɔw kɛrɛfɛ. N’i ​​bɛ baara Kɛ ni bootstrap.js dalajɛlen (walima min Bɔlen dòn) ye, kun t’a la k’o Dòn a la—a bɛ yen kaban.

Baara kɛ ni ko kɛlenw ye

Misali damadɔ bɛ sɔrɔ 'tɛmɛsira 'kɔnɔ:

  • Sliding walima fading in modals
  • Fading ka bɔ tabs
  • Fading out lasɔminiw
  • Panneaux de carousel (panneaux carrusels) minnu bɛ sɛgɛsɛgɛ

Misaliw

Modalw bɛ nɔgɔya, nka u bɛ se ka wuli ka bɔ u nɔ na, ​​kumaɲɔgɔnya ɲininkaliw ni baarakɛcogo fitinin wajibiyalenw ani defaults hakilitigiw.

Misali jɔlen

Modal rendered min bɛ ni kuncɛ, farikolo ani walew kulu ye jukɔrɔla la.

  1. <div class = "modal dogolen fade" >
  2. <div kalasi = "modal-kunnafoni" >
  3. <butɔni suguya = "butɔni" kalasi = "dadon" data-dismiss = "modal" aria-hidden = "tiɲɛ" > × </button> ye
  4. <h3> modɛli kuncɛ </h3>
  5. </div> ye
  6. <div kalasi = "modal-farikolo" >
  7. <p> farikolo ɲuman kelen... </p>
  8. </div> ye
  9. <div kalasi = "modali-sen" >
  10. <a href = "#" kalasi = "btn" > Dadon </a>
  11. <a href = "#" kalasi = "btn btn-primary" > Yɛlɛmaw mara </a>
  12. </div> ye
  13. </div> ye

Demo en direct

Modal dɔ wuli ka bɔ JavaScript fɛ ni i ye butɔni digi min bɛ duguma. A bɛna sɛgɛn ka jigin ka tunun ka bɔ ɲɛ sanfɛ.

  1. <!-- Butɔn ka modal --> daminɛ
  2. <a href = "#myModal" jɔyɔrɔ = "button" kalasi = "btn" data-toggle = "modal" > Demo modali daminɛ </a>
  3.  
  4. <!-- Modal -->
  5. <div id = "myModal" kalasi = "modal dogo fade" tabindex = "-1" jɔyɔrɔ = "dialog" aria-labelledby = "myModalLabel" aria-dogolen = "tiɲɛ" >
  6. <div kalasi = "modal-kunnafoni" >
  7. <butɔni suguya = "butɔni" kalasi = "dadon" data-dismiss = "modal" aria-hidden = "tiɲɛ" > × </button>
  8. <h3 id = "myModalLabel" > Modali kuncɛ </h3>
  9. </div> ye
  10. <div kalasi = "modal-farikolo" >
  11. <p> farikolo ɲuman kelen... </p>
  12. </div> ye
  13. <div kalasi = "modali-sen" >
  14. <button class = "btn" data- dismiss = "modal" aria-hidden = "tiɲɛ" > Dadon </button>
  15. <button class = "btn btn-primary" > Yɛlɛmaw mara </button>
  16. </div> ye
  17. </div> ye

Baarakɛcogo

Donanw ka fɛnɲɛnɛmaw fɛ

Modal dɔ baara k’a sɔrɔ i ma JavaScript sɛbɛn. Set data-toggle="modal"on controleur element, i n’a fɔ butɔni, ka fara a kan data-target="#foo"walima href="#foo"ka target modal kɛrɛnkɛrɛnnen dɔ toggle.

  1. <button type = "button" data-toggle = "modal" data-target = "#myModal" > Modal daminɛ </button>

JavaScript fɛ

Modal dɔ wele ni id myModalye ni JavaScript sɛrɛ kelen ye:

  1. $ ( '#n ka Modal' ). modal ( sugandiliw ) .

Sugandili minnu bɛ kɛ

Sugandili bɛ se ka tɛmɛ data attributes walima JavaScript fɛ. Donanw cogoyaw kama, aw bɛ sugandi tɔgɔ fara data-, i n’a fɔ a bɛ cogo min na data-backdrop="".

Tɔ̀gɔ ka sɛbɛen masin na fɔlɔ cogojirali
kɔkannakow boolean ye sɛbɛ Modal-backdrop element dɔ bɛ a kɔnɔ. O cogo kelen na, a jira staticka ɲɛsin kɔkannafɛn dɔ ma min tɛ modal da tugu click kan.
klaviyeti ye boolean ye sɛbɛ A bɛ modal da tugu ni escape key digilen don
k'a jira boolean ye sɛbɛ A bɛ modɛli jira ni a daminɛna.
samanen sira nkalon

Ni yɔrɔjan url dɔ dira, kɔnɔkow bɛna doni jQuery ka loadfɛɛrɛ fɛ ka pikiri kɛ .modal-body. Ni i bɛ baara kɛ ni data api ye, i bɛ se ka baara kɛ ni hreftag ye cogo wɛrɛ la walasa ka yɔrɔjan sɔrɔyɔrɔ jira. O misali dɔ jiralen bɛ jukɔrɔ:

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

Fɛɛrɛw

.modal(sugandiliw) .

A bɛ i ka kɔnɔkow baara i n’a fɔ modal. A bɛ sɔn sugandiliw ma minnu bɛ se ka kɛ object.

  1. $ ( '#n ka Modal' ). modɛli ({
  2. klaviyeti : nkalon
  3. })

.modal('toggle') .

A bɛ modal dɔ wuli ni bolo ye.

  1. $ ( '#n ka Modal' ). modali ( 'toggle' ) .

.modal(' jira')

A bɛ modal dɔ da wuli ni bolo ye.

  1. $ ( '#n ka Modal' ). modal ( 'jira' ) .

.modal('ka dogo')

A bɛ modal dɔ dogo ni bolo ye.

  1. $ ( '#n ka Modal' ). modal ( 'dogo' ) .

Ko minnu kɛra

Bootstrap ka modal class bɛ ko damadɔw jira kɛnɛ kan walasa ka hooking kɛ modal baarakɛcogo la.

Lajɛrɛ Cogojirali
k'a jira O ko in bɛ tasuma Bɔ o yɔrɔnin bɛɛ ni showmisali fɛɛrɛ Weelela.
jiralen don O ko in bɛ Fɔ ni modal Kɛra ka Ye baarakɛla fɛ (a bɛna css 'tɛmɛsiraw makɔnɔ ka Dafa).
ka dogo O ko in bɛ Fɔ o yɔrɔnin bɛɛ ni hidemisali fɛɛrɛ Weelera.
dogolen O ko in bɛ Fɔ ni modal ye dogolen Ban baarakɛla la (a bɛna css transitions makɔnɔ ka ban).
  1. $ ( '#n ka Modal' ). kan ( 'dogolen' , baara () { .
  2. // ka fɛn dɔ kɛ...
  3. })

Misali la navbar kɔnɔ

ScrollSpy plugin ye nav laɲiniw ladamuni ye a yɛrɛma ka da scroll jɔyɔrɔ kan. I ka yɔrɔ lajɛ min bɛ navbar jukɔrɔ ani ka kalansen min bɛ baara kɛ, o fɛn caman Changement lajɛ. Fɛn fitinin minnu bɛ jigin, olu fana bɛna jira.

@belebeleba

Annonce leggings keytar, brunch id art fête dolor labore. Bamako, Mali. Pitchfork yr enim lo-fi sani u ka qui. Tumblr foro-ka-tabali bisikili josariyaw fɛn o fɛn. Anim keffiyeh carles ka karti. Velit seitan mcsweeney ka fototalan 3 waraba kalo irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui n'a sɔrɔ i ma u mɛn et cardigan fond de confiance culpa biodiesel wes anderson esthétique. Nihil tatouage accusamus, cred ironie biodiesel keffiyeh artisan ullamco consequat.

@mdo ye

Veniam marfa moustache skateboard, adipisicing fugiat velit fourchette barbe. Freegan kunsigi aliqua cupidatat mcsweeney ka vero. Cupidatat naani loko nisi, ea helvetica nulla carles. Tatouage cosby sweater dumuni camion, mcsweeney ka quis non freegan vinyl. Lo-fi wes anderson +1 ye fɛn ye min bɛ se ka kɛ. Carles non esthétique exercice quis gentrify. Bamako, Mali. Brooklyn adipisicing bololabaarakɛlaw ka biyɛri vice keytar deserunt.

kelen

Occaecat komodo min bɛ wele ko aliqua delectus. Fap artisanat bière deserunt skateboard ea. Lomo bisikili josariyaw adipisicing banh mi, velit ea sunt nivo nata locavore kafe kelen-kelen na magna veniam. Vinyle id de haute vie, écho parc consequat quis aliquip banh mi fourchette. Vero VHS ye farikolojɔli dumuniw ye. Consectetur nisi DIY mini cidenw ka sakɔsi. Cred ex in, delectus consectetur fanny pack iphone ka baara sabatili ye.

fila

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 ciden sakɔsi marfa fɛn o fɛn delectus dumuni kamiyɔn. Sapiente sinteti id assumenda. Locavore sed helvetica cliche irony, sanpɛrɛnw i bɛ se ka u ma mɛn u la consequat hoodie gluten-free lo-fi fap aliquip. Laboure elit placeat sanni u ka feere ka ban, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan artisanat bière seitan labɛnnen velit. VHS chambray laboris ye muso ye min bɛ wele ko veniam tempor. Anim mollit minim commodo ullamco sanpɛrɛnw.


Baarakɛcogo

Donanw ka fɛnɲɛnɛmaw fɛ

Walasa ka scrollspy kɛcogo Fàra nɔgɔya la i ka topbar navigation kan, data-spy="scroll"i b’a fɛ ka spy min Kɛ, i bɛ Fàra o kan dɔrɔn (a ka c’a la nin bɛ Kɛ farikolo ye) ani data-target=".navbar"ka nav min sugandi i bɛ baara Kɛ ni min ye. I b’a fɛ ka baara kɛ ni scrollspy ye ni .navcomponent dɔ ye.

  1. <farikolo data-spy = "scroll" data-laɲini = ".navbar" > ... </body>

JavaScript fɛ

Aw bɛ scrollspy wele JavaScript fɛ:

  1. $ ( '#navbar' ye ) ye. sɛbɛnfura () .
Kungolow bɛ wuli! Navbar jɛgɛnw ka kan ka kɛ ni id laɲiniw ye minnu bɛ se ka ɲɛnabɔ. Misali la, a <a href="#home">home</a>ka kan ka bɛn fɛn dɔ ma dom kɔnɔ i n’a fɔ <div id="home"></div>.

Fɛɛrɛw

.scrollspy('lakurayali')

Ni aw bɛ baara kɛ ni scrollspy ye ka fara fɛnw farali walima u bɔli kan DOM kɔnɔ, aw bɛna a ɲini ka refresh fɛɛrɛ wele i n’a fɔ:

  1. $ ( '[data-spy="sɛbɛnni"]' ). kelen-kelen bɛɛ ( baara () { .
  2. var $spy = $ ( nin ). scrollspy ( ‘lafiɲɛbɔ’ ) .
  3. });

Sugandili minnu bɛ kɛ

Sugandili bɛ se ka tɛmɛ data attributes walima JavaScript fɛ. Donanw cogoyaw kama, aw bɛ sugandi tɔgɔ fara data-, i n’a fɔ a bɛ cogo min na data-offset="".

Tɔ̀gɔ ka sɛbɛen masin na fɔlɔ cogojirali
offset (fɔcogo ɲuman). nimɔrɔ 10 ye Pixels ka offset ka bɔ sanfɛ ni jatebɔ jɔyɔrɔ scroll.

Ko minnu kɛra

Lajɛrɛ Cogojirali
ka baara kɛ O ko in bɛ tasuma Bɔ tuma o tuma ni fɛn kura dɔ Kɛra baara la scrollspy fɛ.

Misali tablɛtiw

Tab baarakɛcogo teliyalen, fangama dɔ fara a kan walasa ka tɛmɛ ni sigida kɔnɔkow pannew ye, hali ni fɛnw ye minnu bɛ jigin.

Raw denim i bɛ se ka u ma mɛn u jean shorts Austin. Nesciunt tofu stumptown aliqua, retro sinteti master saniya. Moustache cliche tempor, williamsburg carles ka helvetica sogo-minɛ. Reprehenderit butcher retro keffiyeh sugo minɛbaga synth. Cosby sweater eu banh mi, qui irure terry richardson ex calmar. Bamako, Mali. Aliquip placeat ka baara kɛ ni iphone ye. Seitan aliquip quis cardigan ameriki fini, sogo feerela 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.


Baarakɛcogo

Tabable tabs daminɛ JavaScript fɛ (tab kelen-kelen bɛɛ ka kan ka baara kɛ kelen-kelen):

  1. $ ( '#n ka Tab a' ). digi ( baarakɛcogo ( e ) { .
  2. e . baliDefault ();
  3. $ ( nin ). tab ( 'jira' );
  4. })

Aw bɛ se ka tablo kelen-kelen bɛɛ baara cogo caman na:

  1. $ ( '#ne ka Tab a[href="#profile"]' ). tab ( 'jira' ); // Tab sugandi tɔgɔ fɛ
  2. $ ( '#n ka Tab a:fɔlɔ' ). tab ( 'jira' ); // Tab fɔlɔ sugandi
  3. $ ( '#n ka Tab a: laban' ). tab ( 'jira' ); // Tab laban sugandi
  4. $ ( '#n ka Tab li:eq(2) a' ). tab ( 'jira' ); // Tab sabanan sugandi (0-indexed) .

Markup (Marka) ye

I bɛ se ka tab walima pill navigation dɔ baara k’a sɔrɔ i ma JavaScript si sɛbɛn ni i ye element dɔ jira dɔrɔn data-toggle="tab"walima a kan. data-toggle="pill"Ni i ye navand nav-tabsclasses fara tab kan ul, o bɛna Bootstrap tab styling waleya.

  1. <ul kalasi = "nav nav-tabs" >
  2. <li><a href = "#so" data-toggle = "tab" > So </a></li>
  3. <li><a href = "#profile" data-toggle = "tab" > Ɲɛjirali </a></li>
  4. <li><a href = "#cikanw" data-toggle = "tab" > Cikanw </a></li>
  5. <li><a href = "#settings" data-toggle = "tab" > Labɛnw </a></li>
  6. </ul>

Fɛɛrɛw

$().tab ye

A bɛ tab element ni kɔnɔkow minɛn dɔ baara. Tab ka kan ka kɛ ni a ye data-targetwalima ni hreftargeting a container node ye DOM kɔnɔ.

  1. <ul kalasi = "nav nav-tabs" id = "ne ka Tab" >
  2. <li kalasi = "baarakɛ" ><a href = "#so" > So </a></li>
  3. <li><a href = "#profile" > Ɲɛjirali </a></li>
  4. <li><a href = "#cikanw" > Cikanw </a></li>
  5. <li><a href = "#settings" > Labɛnw </a></li>
  6. </ul>
  7.  
  8. <div kalasi = "tablo-kɔnɔkow" >
  9. <div kalasi = "tablo-pane active" id = "so" > ... </div>
  10. <div kalasi = "tab-pane" id = "profil" > ... </div>
  11. <div kalasi = "tab-pane" id = "cikanw" > ... </div>
  12. <div kalasi = "tab-pane" id = "labɛnw" > ... </div>
  13. </div> ye
  14.  
  15. <sɛbɛnni>
  16. $ ( baara () { .
  17. $ ( '#n ka Tab a: laban' ). tab ( 'jira' );
  18. })
  19. </script> ye

Ko minnu kɛra

Lajɛrɛ Cogojirali
k'a jira Nin ko in bɛ tasuma don tab jirali la, nka sanni tab kura ka jira. Baara kɛ event.targetni ani event.relatedTargetye walasa ka tablo active ani tab active tɛmɛnen (ni o bɛ sɔrɔ) laɲini.
jiralen don Nin ko in bɛ tasuma don tab jirali la tab jiralen kɔfɛ. Baara kɛ event.targetni ani event.relatedTargetye walasa ka tablo active ani tab active tɛmɛnen (ni o bɛ sɔrɔ) laɲini.
  1. $ ( 'a[data-toggle="tab"]' ). kan ( 'jiralen' , baara ( e ) { .
  2. e . laɲini // tab min bɛ baara kɛ
  3. e . relatedTarget // tab tɛmɛnen
  4. })

Misaliw

A lawulilen don ni jQuery.tipsy plugin ɲumanba ye min sɛbɛnna Jason Frame fɛ; Baarakɛminɛnw ye sɛgɛsɛgɛli kura ye, minnu tɛ u jigi da jaw kan, u bɛ baara kɛ ni CSS3 ye animationw kama, ani data-attributes sigida tɔgɔw marali kama.

Baarakɛcogo kunw na, baarakɛminɛnw ni popover data-apis bɛ opt in, o kɔrɔ ye ko i yɛrɛ ka kan k’u daminɛ .

I bolo digi jukɔrɔla yɔrɔw kan walasa ka baarakɛminɛnw lajɛ:

Tight pants next level keffiyeh n'a sɔrɔla i ma u mɛn. Foto cabine barbe cru denim letterpress vegan ciden sac stumptown. Foro-ka-tabali seitan, mcsweeney ka fixie sabatilen quinoa 8-bit ameriki finiw bɛ ni terry richardson vinyl chambray ye. Barbu stumptown, cardigans banh mi lomo sanpɛrɛnw. Tofu biodiesel williamsburg marfa, naani loko mcsweeney ka saniya vegan chambray. A tiɲɛ na ironic artisan whatever keytar , scenester foro-ka-tabali banksy Austin twitter bolo freegan cred raw denim kelen-origin kafe viral.

Sira naani

Baarakɛminɛnw ladilikanw donna kuluw kɔnɔ

Ni i bɛ baara kɛ ni baarakɛminɛnw ni popovers ye ni Bootstrap donna kuluw ye, i bɛna container(sɛbɛnni min bɛ duguma) sugandi walasa ka i yɛrɛ tanga kɔlɔlɔw ma minnu man ɲi.


Baarakɛcogo

Baarakɛminɛn in daminɛ JavaScript fɛ:

  1. $ ( '#misali' ). baarakɛminɛnw ( sugandiliw ) .

Sugandili minnu bɛ kɛ

Sugandili bɛ se ka tɛmɛ data attributes walima JavaScript fɛ. Donanw cogoyaw kama, aw bɛ sugandi tɔgɔ fara data-, i n’a fɔ a bɛ cogo min na data-animation="".

Tɔ̀gɔ ka sɛbɛen masin na fɔlɔ cogojirali
animation (ɲɛnamaya kɛcogo ɲuman). boolean ye sɛbɛ css fade transition dɔ kɛ baarakɛminɛnw kɔnɔ
html ye boolean ye nkalon html don baarakɛminɛnw kɔnɔ . Ni nkalon don, jquery ka textfɛɛrɛ bɛna kɛ ka kɔnɔkow don dom kɔnɔ. Baara kɛ ni sɛbɛnni ye ni i bɛ hami XSS binkanniw na.
bilali sen kan juru | baarakunda 'san fɛ' baarakɛminɛnw sigicogo - sanfɛ | duguma | kinin fɛ | jo
sugandilikɛla gaari nkalon Ni sugandili dɔ dira, baarakɛminɛnw ɲɛfɔli fɛnw bɛna di laɲini kofɔlenw ma.
titiri juru | baarakunda '' '' . default title value ni `title` taamasiyɛn tɛ yen
ka ci gaari 'hover focus' ye. baarakɛminɛnw bɛ daminɛ cogo min na - i ka | hover | sinsinnan | min bɛ fɛn bolo la. A kɔlɔsi ko ka tɛmɛn trigger mutliple, yɔrɔ danfaralen, trigger suguyaw.
ka mɛ jate | minɛn 0 ye

delay jirali ni dogoli baarakɛminɛnw (ms) - o tɛ tali kɛ bololabaarakɛlaw ka daminɛ suguya la

Ni nimɔrɔ dɔ dira, delay bɛ kɛ hide/show fila bɛɛ la

Fɛnw jɔcogo ye:delay: { show: 500, hide: 100 }

minɛn kɔnɔ juru | nkalon nkalon

A bɛ baarakɛminɛnw ɲɛfɔli fara fɛn kɛrɛnkɛrɛnnen dɔ kancontainer: 'body'

Kungolow bɛ wuli! Sugandili minnu bɛ kɛ baarakɛminɛn kelen-kelen bɛɛ la, olu bɛ se ka ɲɛfɔ cogo wɛrɛ la ni kunnafonidilanw cogoyaw ye.

Markup (Marka) ye

  1. <a href = "#" data-toggle = "baarakɛminɛnw" title = "baarakɛminɛn fɔlɔw" > i bolo digi ne kan </a>

Fɛɛrɛw

$().baarakɛminɛnw(sugandiliw) .

A bɛ baarakɛminɛn dɔ nɔrɔ fɛnw lajɛlen dɔ la.

.tooltip(' jira') .

A bɛ element dɔ ka baarakɛminɛnw jira.

  1. $ ( '#fɛn' ). baarakɛminɛnw ɲɛfɔli ( 'jira' ) .

.tooltip('dogo') .

A bɛ fɛn dɔ ka baarakɛminɛn dɔ dogo.

  1. $ ( '#fɛn' ). baarakɛminɛnw ɲɛfɔli ( 'dogo' ) .

.baarakɛminɛnw ɲɛfɔli('toggle')

A bɛ fɛn dɔ ka baarakɛminɛnw sɛgɛsɛgɛli wuli.

  1. $ ( '#fɛn' ). baarakɛminɛnw ɲɛfɔli ( 'toggle' ) .

.tooltip('ka tiɲɛni')

A bɛ fɛn dɔ ka baarakɛminɛn dɔ dogo ani k’a Tiɲɛ.

  1. $ ( '#fɛn' ). baarakɛminɛnw ɲɛfɔli ( 'hakili' ) .

Misaliw

Aw bɛ kɔnɔkow dacogo misɛnninw fara ɲɔgɔn kan, i n’a fɔ iPad kan, fɛn o fɛn na walasa ka kunnafoni filananw sigi. Aw bɛ aw bolo digi butɔni kan walasa ka popover daminɛ. A bɛ Tooltip wajibiya ka don a kɔnɔ.

Popover statique ye

Sugandili naani bɛ yen: sanfɛ, kinin fɛ, duguma ani numan fɛ.

Popover sanfɛ

Sed posuere consectetur est ka bɔ lobortis la. Aenean eu leo ​​quam. Pellentesque ornare sem lacinia quam venenatis vestibulum (banakisɛfagalan min bɛ wele ko lacinia quam venenatis vestibulum).

Popover ka kan

Sed posuere consectetur est ka bɔ lobortis la. Aenean eu leo ​​quam. Pellentesque ornare sem lacinia quam venenatis vestibulum (banakisɛfagalan min bɛ wele ko lacinia quam venenatis vestibulum).

Popover duguma

Sed posuere consectetur est ka bɔ lobortis la. Aenean eu leo ​​quam. Pellentesque ornare sem lacinia quam venenatis vestibulum (banakisɛfagalan min bɛ wele ko lacinia quam venenatis vestibulum).

Popover bɔra yen

Sed posuere consectetur est ka bɔ lobortis la. Aenean eu leo ​​quam. Pellentesque ornare sem lacinia quam venenatis vestibulum (banakisɛfagalan min bɛ wele ko lacinia quam venenatis vestibulum).

Marka si ma jira iko popovers tɛ sɔrɔ JavaScript ni kɔnɔkow la fɛn dɔ kɔnɔ data.

Demo en direct

Sira naani


Baarakɛcogo

Popovers baara kɛ JavaScript fɛ:

  1. $ ( '#misali' ). popover ( sugandiliw ) .

Sugandili minnu bɛ kɛ

Sugandili bɛ se ka tɛmɛ data attributes walima JavaScript fɛ. Donanw cogoyaw kama, aw bɛ sugandi tɔgɔ fara data-, i n’a fɔ a bɛ cogo min na data-animation="".

Tɔ̀gɔ ka sɛbɛen masin na fɔlɔ cogojirali
animation (ɲɛnamaya kɛcogo ɲuman). boolean ye sɛbɛ css fade transition dɔ kɛ baarakɛminɛnw kɔnɔ
html ye boolean ye nkalon Aw bɛ html don popover kɔnɔ . Ni nkalon don, jquery ka textfɛɛrɛ bɛna kɛ ka kɔnɔkow don dom kɔnɔ. Baara kɛ ni sɛbɛnni ye ni i bɛ hami XSS binkanniw na.
bilali sen kan juru | baarakunda 'jo' cogo min na ka popover sigi - sanfɛ | duguma | kinin fɛ | jo
sugandilikɛla gaari nkalon ni sugandili dɔ dira, baarakɛminɛnw ɲɛfɔli fɛnw bɛna di laɲini kofɔlenw ma
ka ci gaari 'kliki' ye. popover bɛ daminɛ cogo min na - i ka | hover | sinsinnan | min bɛ fɛn bolo la
titiri juru | baarakunda '' '' . default title value ni `title` fɛnsɛbɛn tɛ yen
kɔnɔnafɛn juru | baarakunda '' '' . kɔnɔkow nafa fɔlɔ ni `data-content` fɛnsɛbɛn tɛ yen
ka mɛ jate | minɛn 0 ye

delay jirali ni a dogo popover (ms) - o tɛ tali kɛ bololabaarakɛlaw ka trigger suguya la

Ni nimɔrɔ dɔ dira, delay bɛ kɛ hide/show fila bɛɛ la

Fɛnw jɔcogo ye:delay: { show: 500, hide: 100 }

minɛn kɔnɔ juru | nkalon nkalon

A bɛ popover fara fɛn kɛrɛnkɛrɛnnen dɔ kancontainer: 'body'

Kungolow bɛ wuli! Sugandili minnu bɛ kɛ popover kelen-kelenw na, olu bɛ se ka ɲɛfɔ cogo wɛrɛ la ni data attributes (daɲɛw) fɛnw ye.

Markup (Marka) ye

Baarakɛcogo kunw na, Tooltip ani Popover data-apis bɛ opt in. N’i b’a fɛ ka baara kɛ n’u ye, i ka sugandili sugandilen dɔ jira dɔrɔn.

Fɛɛrɛw

$().popover(sugandiliw) .

A bɛ popovers daminɛ ka ɲɛsin element collection dɔ ma.

.popover(' jira')

A bɛ elements popover dɔ jira.

  1. $ ( '#fɛn' ). popover ( 'jira' ) .

.popover('ka dogo')

A bɛ dogo ni elements popover ye.

  1. $ ( '#fɛn' ). popover ( 'dogo' ) .

.popover('toggle') .

Toggles an éléments popover.

  1. $ ( '#fɛn' ). popover ( 'kɔnɔnafili' ) .

.popover('ka tiɲɛni kɛ')

A bɛ element dɔ ka popover dogo ani k’a tiɲɛ.

  1. $ ( '#fɛn' ). popover ( 'hakili' ) .

Misali lasɔminiw

Aw bɛ dismiss baarakɛcogo fara lasɔmini cikanw bɛɛ kan ni nin plugin in ye.

Guacamole senuma! Best check yo self, i ma filɛ ka ɲɛ kojugu.

Oh snap! I ye fili dɔ sɔrɔ!

Aw bɛ nin ni nin fɛn caman Changer ani ka segin ka a lajɛ. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus bɛ sigi amet fermentum la.

Aw ye nin wale in kɛ Walima aw ka nin kɛ


Baarakɛcogo

A’ ye lasɔmini dɔ bilali daminɛ JavaScript fɛ:

  1. $ ( ".kɔlɔsili" ). lasɔmini () .

Markup (Marka) ye

Dɔrɔn dɔ fara data-dismiss="alert"i ka dadon butɔni kan walasa ka a yɛrɛma ka alert close functionality di.

  1. <a kalasi = "dadon" data-dismiss = "kɔlɔsili" href = "#" > &waatiw; </a>

Fɛɛrɛw

$().alert() ye.

A bɛ lasɔminiw bɛɛ siri ni baarakɛcogo surun ye. Walasa i ka lasɔminiw ka ɲɛnamaya kɛ ni u datugulen don, i k’a lajɛ k’u ka .fadeand .inclass (kalanso) bɛ u kan kaban.

.alert('daga')

A bɛ lasɔmini dɔ datugu.

  1. $ ( ".kɔlɔsili" ). alert ( 'dakun' ) .

Ko minnu kɛra

Bootstrap ka lasɔmini kalan bɛ ko damadɔw jira kɛnɛ kan walasa ka jɛgɛn ka don lasɔmini baarakɛcogo la.

Lajɛrɛ Cogojirali
ka datugu O ko in bɛ tasuma Bɔ o yɔrɔnin bɛɛ ni closemisali fɛɛrɛ Weelela.
da tugulen don Nin ko in bɛ Bɔ ni lasɔmini Dafara (a bɛna css 'tɛmɛsiraw makɔnɔ ka Ban).
  1. $ ( '#ne ka-lasɔmini' ). bind ( 'dafalen' , baara () { .
  2. // ka fɛn dɔ kɛ...
  3. })

Misaliw bɛ baara kɛ ni minnu ye

Aw bɛ dɔ fara a kan ni butɔni ye. Kontrɔli butɔni bɛ fɔ walima ka butɔni kuluw Dabɔ yɔrɔ caman kama i n’a fɔ baarakɛminɛnw.

Jamanatigi

Fàra o kan data-loading-text="Loading..."walasa ka baara Kɛ ni doni cogoya ye butɔni dɔ kan.

  1. <button type = "button" class = "btn btn-primary" data-loading-text = "Lase..." > Lase cogoya </button>

Toggle kelen

A fara a kan data-toggle="button"walasa ka toggling baara kɛ butɔni kelen kan.

  1. <butɔni suguya = "butɔni" kalasi = "btn btn-fɔlɔ" data-toggle = "button" > Toggle kelen </button>

A’ ye yɔrɔ lajɛ

A bɛ fara a kan data-toggle="buttons-checkbox"ka ɲɛsin checkbox style toggling ma btn-group kan.

  1. <div kalasi = "btn-kulu" data-toggle = "butɔni-sɛgɛsɛgɛli kɛsu" >
  2. <butɔni suguya = "butɔni" kalasi = "btn btn-fɔlɔ" > Nɛgɛbere </button>
  3. <butɔni suguya = "butɔni" kalasi = "btn btn-fɔlɔ" > Cɛmancɛ </button>
  4. <butɔni suguya = "butɔni" kalasi = "btn btn-fɔlɔ" > Kiɲɛ </button>
  5. </div> ye

Arajo la

A fara a kan data-toggle="buttons-radio"ka arajo cogoya toggling kan btn-group kan.

  1. <div kalasi = "btn-kulu" data-toggle = "butɔni-arajo" >
  2. <butɔni suguya = "butɔni" kalasi = "btn btn-fɔlɔ" > Nɛgɛbere </button>
  3. <butɔni suguya = "butɔni" kalasi = "btn btn-fɔlɔ" > Cɛmancɛ </button>
  4. <butɔni suguya = "butɔni" kalasi = "btn btn-fɔlɔ" > Kiɲɛ </button>
  5. </div> ye

Baarakɛcogo

Butɔnw daminɛni JavaScript fɛ:

  1. $ ( '.nav-tabs' ). butɔni () .

Markup (Marka) ye

Donanw ka fɛnw ye fɛnba ye min bɛ butɔni plugin kɔnɔ. Aw ye misali kode lajɛ min bɛ duguma walasa ka taamasiyɛn suguya caman sɔrɔ.

Sugandili minnu bɛ kɛ

Foɲisi

Fɛɛrɛw

$().button('toggle') Bamako, Mali.

Toggles push jamana. A bɛ butɔni di i n’a fɔ a bɛ baara la.

Kungolow bɛ wuli! Aw bɛ se ka butɔni dɔ ka auto toggling (otoggling) daminɛ ni aw bɛ baara kɛ ni o data-togglefɛnsɛbɛnni ye.
  1. <butɔni suguya = "butɔni" kalasi = "btn" data-toggle = "butɔni" > ... </butɔni>

$().button('ka doni')

A bɛ butɔni cogoya sigi doni la - a bɛ butɔni bali ani ka sɛbɛnniw ɲɔgɔn falen ka sɛbɛnniw doni. sɛbɛnniw doni ka kan ka ɲɛfɔ butɔni yɔrɔ kan ni data attribute ye data-loading-text.

  1. <button type = "button" class = "btn" data-loading-text = "fɛnw doni..." > ... </button>
Kungolow bɛ wuli! Firefox bɛ to senna cogo la min bɛ se ka kɛ ɲɛw doni ye . o furakɛcogo dɔ ye ka baara kɛ ni a ye autocomplete="off".

$().button('segin') .

A bɛ butɔni cogoya lasegin - a bɛ sɛbɛnniw falen-falen ka kɛ sɛbɛn fɔlɔ ye.

$().button(sɛgɛsɛgɛli) .

A bɛ butɔni cogoya lasegin - a bɛ sɛbɛnniw ɲɔgɔn falen-falen ka kɛɲɛ ni sɛbɛnni cogoya o kunnafoni ɲɛfɔlen ye.

  1. <butɔni suguya = "butɔni" kalasi = "btn" data-complete-text = "ban!" > ... </butɔni>
  2. <sɛbɛnni>
  3. $ ( '.btn' ye ) ye. butɔni ( 'dafalen' ) .
  4. </script> ye

Kan

Aw ye basigi cogoyaw sɔrɔ ani dɛmɛn min bɛ se ka wuli ka bɔ a nɔ na i n’a fɔ accordions ani navigation.

* A b’a ɲini Transitions plugin ka don a kɔnɔ.

Misali la, accordéon

Baara kɛli ni collapse plugin ye, an ye accordéon style widget nɔgɔman dɔ jɔ:

Anim pariatur cliche reprehenderit, enim eiusmod ɲɛnamaya sanfɛ accusamus terry richardson ad kalama. 3 waraba kalo officia aute, non cupidat patinage dolor brunch. Dumunikɛminɛn min bɛ wele ko quinoa nesciunt laborum eiusmod. Brunch 3 waraba kalo tempor, sunt aliqua bila kɔnɔ dɔ kan a kan squid kelen-origin kafe nulla assumenda shoreditch et. Nihil ani keffiyeh helvetica, bololabaarakɛlaw ka biyɛri baara wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur sosifa vice lomo. Leggings occaecat craft beer foro-ka-tabali, raw denim aesthetic synth nesciunt n'a sɔrɔ i ma mɛn u accusamus labore sustainable VHS.
Anim pariatur cliche reprehenderit, enim eiusmod ɲɛnamaya sanfɛ accusamus terry richardson ad kalama. 3 waraba kalo officia aute, non cupidat patinage dolor brunch. Dumunikɛminɛn min bɛ wele ko quinoa nesciunt laborum eiusmod. Brunch 3 waraba kalo tempor, sunt aliqua bila kɔnɔ dɔ kan a kan squid kelen-origin kafe nulla assumenda shoreditch et. Nihil ani keffiyeh helvetica, bololabaarakɛlaw ka biyɛri baara wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur sosifa vice lomo. Leggings occaecat craft beer foro-ka-tabali, raw denim aesthetic synth nesciunt n'a sɔrɔ i ma mɛn u accusamus labore sustainable VHS.
Anim pariatur cliche reprehenderit, enim eiusmod ɲɛnamaya sanfɛ accusamus terry richardson ad kalama. 3 waraba kalo officia aute, non cupidat patinage dolor brunch. Dumunikɛminɛn min bɛ wele ko quinoa nesciunt laborum eiusmod. Brunch 3 waraba kalo tempor, sunt aliqua bila kɔnɔ dɔ kan a kan squid kelen-origin kafe nulla assumenda shoreditch et. Nihil ani keffiyeh helvetica, bololabaarakɛlaw ka biyɛri baara wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur sosifa vice lomo. Leggings occaecat craft beer foro-ka-tabali, raw denim aesthetic synth nesciunt n'a sɔrɔ i ma mɛn u accusamus labore sustainable VHS.
  1. <div kalasi = "accordion" id = "accordion2" >
  2. <div kalasi = "accordion-kulu" >
  3. <div class = "accordion-kunnafoni" >
  4. <a class = "accordion-toggle" data-toggle = "dafalen" donan-bangebagaw = "#accordion2" href = "#collapseOne" >
  5. Jɛkulu ka fɛn #1 min bɛ se ka da ɲɔgɔn kan
  6. </a>
  7. </div> ye
  8. <div id = "collapseOne" class = "accordion-farikolo bɛ bin" >
  9. <div kalasi = "accordion-kɔnɔna" >
  10. Anim pariatur cliché ye...
  11. </div> ye
  12. </div> ye
  13. </div> ye
  14. <div kalasi = "accordion-kulu" >
  15. <div class = "accordion-kunnafoni" >
  16. <a class = "accordion-toggle" data-toggle = "dafalen" donan-bangebagaw = "#accordion2" href = "#collapseTwo" >
  17. Jɛkulu min bɛ se ka da ɲɔgɔn kan, o ye fɛn #2 ye
  18. </a>
  19. </div> ye
  20. <div id = "collapseTwo" class = "akɔdi-farikolo bɔgɔlan" >
  21. <div kalasi = "accordion-kɔnɔna" >
  22. Anim pariatur cliché ye...
  23. </div> ye
  24. </div> ye
  25. </div> ye
  26. </div> ye
  27. ...

Aw bɛ se fana ka baara kɛ ni plugin ye ni accordéon taamasiyɛn tɛ. Aw bɛ butɔni dɔ kɛ ka fɛn wɛrɛ bonya ni a bincogo wuli.

  1. <butɔni suguya = "butɔni" kalasi = "btn btn-farati" data-toggle = "collapse" data-target = "#demo" >
  2. nɔgɔman min bɛ se ka wuli
  3. </button> ye
  4.  
  5. <div id = "demo" kalasi = "dafalen don" > ... </div>

Baarakɛcogo

Donanw ka fɛnɲɛnɛmaw fɛ

Dɔrɔn farali data-toggle="collapse"ani a data-targetto element ka otomatiki assign control de un collapsible element. Attribut data-targetbɛ sɔn css sugandili ma walasa ka collapse kɛ a kan. Aw ye aw jija ka kalasi fara fɛn dɔ kan min bɛ collapsese ka wuli. N'i b'a fɛ a ka da wuli, i ka kalansen wɛrɛ fara a kan in.

Walasa ka kulu ɲɛnabɔli min bɛ i n’a fɔ akordeyɔn, o fara kunnafoni-falen-falen-falen-falen-falen kan, i ka kunnafoni-falen-falen-falen-falen-falen-falen fara a kan data-parent="#selector". Aw ye demo lajɛ walasa ka nin ye wale la.

JavaScript fɛ

A bɛ se ka baara kɛ ni bolo ye ni:

  1. $ ( ".dafalen" ). bɔgɔbɔgɔ () .

Sugandili minnu bɛ kɛ

Sugandili bɛ se ka tɛmɛ data attributes walima JavaScript fɛ. Donanw cogoyaw kama, aw bɛ sugandi tɔgɔ fara data-, i n’a fɔ a bɛ cogo min na data-parent="".

Tɔ̀gɔ ka sɛbɛen masin na fɔlɔ cogojirali
bangebaga sugandilikɛla nkalon Ni sugandili Kɛra o tuma na fɛn minnu bɛ Se ka Dabɔ bangebaga kofɔlen jukɔrɔ olu bɛɛ bɛ Dabɔ ni nin fɛn min bɛ Se ka Dabɔ o jiralen dòn. (a bɛ tali kɛ laadala acordion kɛcogo la) .
toggle (toggle) kɛ boolean ye sɛbɛ A bɛ fɛn min bɛ Se ka Dabɔ, o bɛ Yɛlɛma weleli kan

Fɛɛrɛw

.collapse(sugandiliw) .

A bɛ i ka kɔnɔkow baara i n’a fɔ fɛn min bɛ se ka da ɲɔgɔn kan. A bɛ sɔn sugandiliw ma minnu bɛ se ka kɛ object.

  1. $ ( '#ne ka Collapsible' ). bɔgɔbɔgɔ ({
  2. toggle : nkalon
  3. })

.collapse('toggle') Bamako, Mali.

A bɛ fɛn dɔ wuli ka bɔ a nɔ na ka taa jira walima ka dogo.

.collapse(' jira')

A bɛ fɛn dɔ jira min bɛ se ka wuli.

.collapse('dogo') .

A bɛ fɛn dɔ dogo min bɛ Se ka Dabɔ.

Ko minnu kɛra

Bootstrap ka collapse class bɛ ko damadɔw bɔ kɛnɛ kan ka ɲɛsin hooking into collapse functionality ma.

Lajɛrɛ Cogojirali
k'a jira O ko in bɛ tasuma Bɔ o yɔrɔnin bɛɛ ni showmisali fɛɛrɛ Weelela.
jiralen don O ko in bɛ Fɔ ni fɛn dɔ Dònna 'kɔnɔ min bɛ Ye baarakɛla fɛ (a bɛna css 'tɛmɛsiraw makɔnɔ u ka ban).
ka dogo O ko in bɛ Fɔ o yɔrɔnin bɛɛ ni hidefɛɛrɛ in Weelela.
dogolen O ko in bɛ Fɔ ni 'fɛn dɔ dogolen dòn baarakɛla la (a bɛna css 'tɛmɛsiraw makɔnɔ ka Dafa).
  1. $ ( '#ne ka Collapsible' ). kan ( 'dogolen' , baara () { .
  2. // ka fɛn dɔ kɛ...
  3. })

Misaliya

Plugin basigilen, min bɛ se ka bonya nɔgɔya la walasa ka teliya ka typeahead cɛɲiw dilan ni foroko sɛbɛnni sɛbɛnni suguya o suguya ye.

  1. <doncogo suguya = "sɛbɛn" data-provide = "suguya ɲɛfɛ" >

I b’a fɛ ka sigi autocomplete="off"walasa ka navigatɔrɔn ka menu defaultw bali ka bɔ Bootstrap typeahead yɔrɔ la.


Baarakɛcogo

Donanw ka fɛnɲɛnɛmaw fɛ

Donanw ka fɛnw fara ɲɔgɔn kan walasa ka fɛn dɔ sɛbɛn ni typeahead baarakɛcogo ye i n’a fɔ a jiralen bɛ cogo min na misali la sanfɛ.

JavaScript fɛ

Aw bɛ typeahead wele ni aw bolo ye ni:

  1. $ ( '.sɛbɛnni ɲɛfɛ' ). sɛbɛnni ɲɛfɛ () .

Sugandili minnu bɛ kɛ

Sugandili bɛ se ka tɛmɛ data attributes walima JavaScript fɛ. Donanw cogoyaw kama, aw bɛ sugandi tɔgɔ fara data-, i n’a fɔ a bɛ cogo min na data-source="".

Tɔ̀gɔ ka sɛbɛen masin na fɔlɔ cogojirali
bununda array, baarakɛcogo [ ] . Donanw sɔrɔyɔrɔ min ka kan ka ɲininkali kɛ a kan. A bɛ se ka kɛ sɛrɛw lajɛlen ye walima baarakɛcogo dɔ. Baara bɛ tɛmɛ dalilu fla kan, querynafa min bɛ donna-yɔrɔ la ani processweleli-yɔrɔ. Baarakɛcogo bɛ se ka baara kɛ ni waati kelen ye ni kunnafoni sɔrɔyɔrɔ seginni ye k’a ɲɛsin a yɛrɛ ma walima k’a kɛ cogo wɛrɛ la processweleli segin ka sɔsɔli kelen fɛ.
minɛns nimɔrɔ 8 ye Fɛn minnu ka kan ka jira yɔrɔ la, olu hakɛ maksimali.
minJanya nimɔrɔ 1 ye Karamɔgɔ janya fitinin min ka kan ka kɛ sanni ka hakilinaw daminɛ minnu bɛ kɛ ka u yɛrɛ dafa
matchɛri baarakunda case insensitive (fɔcogo min tɛ fɛn ye). Fɛɛrɛ min bɛ Kɛ k’a Dɔn ni ɲininkali dɔ bɛ Bɛn fɛn dɔ ma. A bɛ Sɔn sɔsɔli kelen ma, o itemmin bɛ ɲininkali kɔrɔbɔ. Aw bɛ se ka ɲininkali kɛ sisan ni this.query. Segin boolean dɔ kan trueni ɲininkali ye bɛnkan ye.
sɛgɛsɛgɛlikɛlan baarakunda bɛnkan tigitigi,
sɛbɛnnibolow ni
sɛbɛnnibolow tɛ kelen ye
Fɛɛrɛ min bɛ kɛ ka autocomplete jaabiw labɛn. A bɛ Sɔn sɔsɔli kelen ma itemsani a bɛ ni typeahead instance ka scope ye. Aw bɛ ɲininkali kɛ sisan ni this.query.
updater (kurayabaga). baarakunda bɛ segin fɛn sugandilen kan Fɛɛrɛ min bɛ kɛ ka fɛn sugandilen segin. A bɛ Sɔn sɔsɔli kelen ma, o itemani a bɛ ni typeahead instance ka scope ye.
fɛn min bɛ ɲɛfɔli kɛ baarakunda bɛ ɲɔgɔndan dafalenw bɛɛ jira Fɛɛrɛ min bɛ kɛ ka autocomplete jaabiw jira. A bɛ Sɔn sɔsɔli kelen ma itemani a bɛ ni typeahead instance ka scope ye. Ka kan ka segin html kan.

Fɛɛrɛw

.typeahead(sugandiliw) .

A bɛ donnakow daminɛ ni typeahead ye.

Misaliya

Subnavigation min bɛ kinin fɛ, o ye affix plugin ka demo ɲɛnama ye.


Baarakɛcogo

Donanw ka fɛnɲɛnɛmaw fɛ

Walasa ka affix kɛcogo fara nɔgɔya la fɛn o fɛn kan, data-spy="affix"i b’a fɛ ka fɛn min sɛgɛsɛgɛ dɔrɔn, i ka o fara a kan. O kɔfɛ, baara kɛ ni offsets ye walasa k’a ɲɛfɔ waati min na i ka kan ka fɛn dɔ pinɛcogo wuli ani ka a ban.

  1. <div data-spy = "affix" kunnafoni-falen-falen-sanfɛ = "200" > ... </div>
Kungolow bɛ wuli! Aw ka kan ka fɛn pinɛlen dɔ jɔyɔrɔ ɲɛnabɔ ani a bangebaga teliya la. jɔyɔrɔ bɛ mara affix, affix-top, ani affix-bottom. Aw ye aw hakili to a la ka bangebaga dɔ lajɛ min bɛ se ka bin ni affix bɛ daminɛ ka don bawo a bɛ kɔnɔkow bɔ ɲɛ in bolicogo nɔgɔman na.

JavaScript fɛ

Affix plugin wele JavaScript fɛ:

  1. $ ( '#navbar' ye ) ye. farankan () .

Sugandili minnu bɛ kɛ

Sugandili bɛ se ka tɛmɛ data attributes walima JavaScript fɛ. Donanw cogoyaw kama, aw bɛ sugandi tɔgɔ fara data-, i n’a fɔ a bɛ cogo min na data-offset-top="200".

Tɔ̀gɔ ka sɛbɛen masin na fɔlɔ cogojirali
offset (fɔcogo ɲuman). jate | baarakɛcogo | minɛn 10 ye Pixels ka offset ka bɔ ekran na ni jatebɔ jɔyɔrɔ scroll. Ni jateden kelen dira, offset bɛna kɛ sanfɛ ni numan fɛ. Walasa ka sira kelen lamɛn, walima ka fɛn caman di minnu tɛ kelen ye, i bɛ fɛn dɔ di dɔrɔn offset: { x: 10 }. Baara kɛ ni baarakɛcogo dɔ ye ni aw mago bɛ ka offset di ni fanga ye (nafa bɛ sɔrɔ dilancogo dɔw la minnu bɛ jaabi di).