Javascript

Weta ngwa Bootstrap na ndụ-ugbu a nwere ngwa mgbakwunye jQuery omenala iri na atọ.

Onye ma ọ bụ chịkọtara

Enwere ike itinye ngwa mgbakwunye n'otu n'otu (n'agbanyeghị ụfọdụ chọrọ ịdabere), ma ọ bụ ha niile otu oge. Abụọ bootstrap.js na bootstrap.min.js nwere plugins niile n'otu faịlụ.

Njirimara data

Ị nwere ike iji plugins Bootstrap niile naanị site na API akara na-edeghị otu ahịrị Javascript. Nke a bụ API klas mbụ Bootstrap ma kwesịrị ịbụ ihe mbụ ị ga-echebara mgbe ị na-eji ngwa mgbakwunye.

Nke ahụ kwuru, n'ọnọdụ ụfọdụ ọ nwere ike ịdị mma ka gbanyụọ ọrụ a. Ya mere, anyị na-enyekwa ikike iji gbanyụọ njirimara data API site na iwepu ihe omume niile dị na aha ahụ nke ejiri ''data-api''. Nke a dị ka nke a:

  1. $ ( 'ahụ' ). gbanyụọ ( '.data-api' )

N'aka nke ọzọ, iji kwado ngwa mgbakwunye a kapịrị ọnụ, tinye naanị aha ngwa mgbakwunye dị ka oghere aha yana data-api namespace dị ka nke a:

  1. $ ( 'ahụ' ). gbanyụọ ( '.alert.data-api' )

API mmemme

Anyị kwenyekwara na ị ga-enwe ike iji plugins Bootstrap naanị site na API Javascript. API ọhaneze niile bụ otu, ụzọ enwere ike ịgbanye, wee weghachi mkpokọta emere.

  1. $ ( ".btn.danger" ). bọtịnụ ( "ịtụgharị" ). addClass ( "abụba" )

Ụzọ niile kwesịrị ịnakwere ihe nhọrọ nhọrọ, eriri nke lekwasịrị anya otu usoro, ma ọ bụ ihe ọ bụla (nke na-amalite ngwa mgbakwunye nwere omume ndabara):

  1. $ ( "#myModal" ). modal () // jiri ndabara malite ya
  2. $ ( "#myModal" ). modal ({ ahụigodo : ụgha }) // ibido na enweghị ahụigodo
  3. $ ( "#myModal" ). modal ( 'show' ) // na-ebido na ịkpọku ihe ngosi ozugbo

Ngwa mgbakwunye ọ bụla na-ekpughekwa ihe nrụpụta ya na akụrụngwa 'Constructor': $.fn.popover.Constructor. Ọ bụrụ na ị ga-achọ ịnweta otu ngwa mgbakwunye ihe atụ, weghachite ya ozugbo na mmewere: $('[rel=popover]').data('popover').

Ihe omume

Bootstrap na-enye mmemme omenala maka ọtụtụ mmemme pụrụ iche nke ngwa mgbakwunye. N'ozuzu, ndị a na-abịa na njedebe njedebe na nke gara aga - ebe njedebe (dịka show) na-akpalite na mmalite nke mmemme, na ụdị nsonye ya gara aga (dịka shown) na-akpalite na mmecha nke omume.

Ihe omume enweghị ngwụcha na-enye ọrụ mgbochi ndabara. Nke a na-enye ikike ịkwụsị mmezu nke ihe tupu ya amalite.

  1. $ ( '#myModal' ). na ( 'show' , ọrụ ( e ) {
  2. ọ bụrụ (! data ) laghachi e . preventDefault () // akwụsị modal igosi
  3. })

Banyere mgbanwe

Maka mmetụta mgbanwe dị mfe, gụnyere bootstrap-transition.js otu ugboro n'akụkụ faịlụ JS ndị ọzọ. Ọ bụrụ na ị na-eji bootstrap.js agbakọtara (ma ọ bụ miniified), ọ dịghị mkpa itinye nke a-ọ dịlarị ebe ahụ.

Jiri ikpe

Ọmụmaatụ ole na ole nke ngwa mgbakwunye mgbanwe:

  • Na-amị amị ma ọ bụ na-ada ada na modal
  • Taabụ na-apụ apụ
  • Na-ebelata ọkwa
  • Ogwe carousel na-amị amị

Ihe atụ

A na-ahazi usoro, mana na-agbanwe agbanwe, na-akpalite mkparịta ụka na arụrụ ọrụ kacha nta achọrọ yana ndabara smart.

Ihe atụ kwụ ọtọ

Modal emepụtara nwere nkụnye eji isi mee, ahụ, na usoro omume n'okpuru ụkwụ.

  1. <div class = "modal hide fade" >
  2. <div class = "modal-header" >
  3. < ụdị bọtịnụ = "bọtịnụ" klaasị = "emechi" data-dismiss = "modal" aria-hidden = "eziokwu" > & ugboro; </bọtịnụ>
  4. <h3> Ihe nkụnye eji isi mee </h3>
  5. </div>
  6. <div klas = "modal-body" >
  7. <p> Otu ahụ mara mma… </p>
  8. </div>
  9. <div class = "modal-footer" >
  10. <a href = "#" klaasị = "btn"> Mechie </a> _
  11. <a href = "#" klas = "btn btn-primary" > Chekwa mgbanwe </a>
  12. </div>
  13. </div>

Ihe ngosi dị ndụ

Gbanwee modal site na JavaScript site na ịpị bọtịnụ dị n'okpuru. Ọ ga-adaba ma daa site n'elu ibe ahụ.

  1. <!-- bọtịnụ iji kpalite modal -->
  2. <a href = "#myModal" ọrụ = "bọtịnụ" klas = "btn" data-toggle = "modal" > Mwepụta ngosi modal </a>
  3.  
  4. <!-- Modal -->
  5. <div id = "myModal" klas = "modal hide fade" tabindex = "-1" ọrụ = "dialog" aria-labelledby = "myModalLabel" aria-hidden = "eziokwu" >
  6. <div class = "modal-header" >
  7. < ụdị bọtịnụ = "bọtịnụ" klaasị = "emechi" data-dismiss = "modal" aria-hidden = "eziokwu" > × </button>
  8. <h3 id = "myModalLabel" > Ntụnye modal </h3>
  9. </div>
  10. <div klas = "modal-body" >
  11. <p> Otu ahụ mara mma… </p>
  12. </div>
  13. <div class = "modal-footer" >
  14. <button class = "btn" data-dismiss = "modal" aria-hidden = "eziokwu" > Mechie </button>
  15. <button class = "btn btn-primary" > Chekwa mgbanwe </button>
  16. </div>
  17. </div>

Ojiji

Site na njirimara data

Mee modal rụọ ọrụ na-edeghị Javascript. Tọọ data-toggle="modal"na ihe njikwa, dị ka bọtịnụ, yana otu data-target="#foo"ma ọ bụ href="#foo"iji lekwasịrị anya otu modal ka ị gbanwee.

  1. <button type = "bọtịnụ" data-toggle = "modal" data-target = "#myModal" > Mwepụta modal </button>

Site na Javascript

Kpọọ modal nwere id myModalnwere otu ahịrị Javascript:

  1. $ ( '#myModal' ). modal ( nhọrọ )

Nhọrọ

Enwere ike ịfefe nhọrọ site na njirimara data ma ọ bụ Javascript. Maka njirimara data, tinye aha nhọrọ na data-, dị ka ọ dị na data-backdrop="".

Aha ụdị ndabara nkọwa
ndabere boolean eziokwu Na-agụnye ihe modal-backdrop element. Nhọrọ, ezipụta staticmaka backdrop nke na-adịghị emechi modal na pịa.
ahụigodo boolean eziokwu Na-emechi modal mgbe ịpị igodo mgbapụ
gosi boolean eziokwu Na-egosi modal mgbe ebido ya.
ime ime uzo ụgha

Ọ bụrụ na ewepụtara url dịpụrụ adịpụ, a ga-ebuba ọdịnaya site na loadusoro jQuery wee tinye n'ime faịlụ .modal-body. Ọ bụrụ na ị na-eji api data, ịnwere ike iji hrefmkpado ọzọ iji kọwaa isi mmalite dịpụrụ adịpụ. E gosiri ihe atụ nke a n'okpuru:

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

Ụzọ

.modal(nhọrọ)

Na-eme ka ọdịnaya gị rụọ ọrụ dị ka modal. Nabata nhọrọ nhọrọ object.

  1. $ ( '#myModal' ). modal ({
  2. ahụigodo : ụgha
  3. })

.modal('ntụgharị')

Iji aka na-atụgharị modal.

  1. $ ( '#myModal' ). modal ( 'ntụgharị' )

.modal('show')

Iji aka na-emepe modal.

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

.modal('zoo')

Iji aka na-ezobe modal.

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

Ihe omume

Klas modal Bootstrap na-ekpughere ihe omume ole na ole maka itinye aka na ọrụ modal.

Ihe omume Nkọwa
gosi Ihe omume a na-agba ọkụ ozugbo showa na-akpọ usoro ihe atụ.
egosiri A na-achụpụ ihe omume a mgbe onye ọrụ mere ka modal ahụ hụ ya (ga-echere ntụgharị css ka agwụchaa).
zoo A na-agbapụ ihe omume a ozugbo hidea kpọrọ usoro ihe atụ.
zoro ezo A na-achụpụ ihe omume a mgbe ezoro ezoro ya n'aka onye ọrụ modal (ga-echere ntụgharị css iji wuchaa).
  1. $ ( '#myModal' ). na ( 'zoro ezo' , ọrụ () {
  2. // mee ihe…
  3. })

Ọmụmaatụ na navbar

Ihe mgbakwunye ScrollSpy bụ maka imelite ebumnuche nav na-akpaghị aka dabere na ọnọdụ mpịakọta. Pịgharịa na mpaghara n'okpuru ebe ịnya ụgbọ mmiri wee lelee mgbanwe klaasị nọ n'ọrụ. A ga-eme ka ọ pụta ìhè nke obere ihe ndọpụta.

@abụba

Ad leggings keytar, brunch id art party dolor labour. Pitchfork yr enim lo-fi tupu ha ere qui. Ikike igwe kwụ otu ebe Tumblr ugbo gaa na tebụl ihe ọ bụla. Anim keffiyeh carles cardigan. Ụlọ foto Velit seitan mcsweeney 3 wolf moon irure. Cosby sweta lomo jean shorts, williamsburg hoodie minim qui eleghị anya, ị nụbeghị banyere ha et cardigan Trust fund culpa biodiesel wes anderson aesthetic. Nihil egbugbu accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.

@mdo

Veniam marfa afụ ọnụ skateboard, adipisicing fugiat velit pitchfork afụ ọnụ. Freegan afụ ọnụ ma ọ bụ mcsweeney's vero. Cupidatat anọ ebe nisi, ma helvetica nulla carles. gwongworo nri cosby sweta egbugbu, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles na-adịghị mma mmega ahụ gentrify. Brooklyn adipisicing craft biya vice keytar deserunt.

otu

Occaecat commodo aliqua delectus. Fap craft biya deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS kacha mma. Consectetur nisi DIY minim bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.

abuo

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 ozi akpa marfa ọ bụla delectus nri gwongworo. Sapiente synth id echere. Locavore sed helvetica cliche irony, thundercats eleghị anya ị nụbeghị banyere ha na-akpata hoodie gluten-free lo-fi fap aliquip. Ụlọ ọrụ dị elu tupu ha ere ere, Terry Richardson proident brunch nesciunt quis cosby sweta pariatur keffiyeh ut helvetica artisan. Cardigan craft biya seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.


Ojiji

Site na njirimara data

Ka mfe tinye scrollspy omume gị topbar igodo, dị nnọọ tinye data-spy="scroll"na mmewere ị chọrọ inyocha na (kasị a ga-abụ ahụ) na data-target=".navbar"họrọ nke nav iji. Ị ga-achọ iji scrollspy nwere .navakụrụngwa.

  1. <body data-spy = "mpịakọta" data-target = ".navbar" > ... </ body>

Site na Javascript

Kpọọ scrollspy site na Javascript:

  1. $ ( '#navbar' ). scrollspy ()
Welie isi elu! Njikọ Navbar ga-enwerịrị ebumnuche id nwere ike idozi. Dịka ọmụmaatụ, a <a href="#home">home</a>ga-ederịrị ihe dị n'ime ụlọ dịka <div id="home"></div>.

Ụzọ

.scrollspy('refresh')

Mgbe ị na-eji scrollspy yana ịgbakwunye ma ọ bụ wepụ ihe ndị dị na DOM, ị ga-akpọ usoro ume ọhụrụ dị ka:

  1. $ ( '[data-spy="mpịakọta"]' ). nke ọ bụla ( ọrụ () {
  2. var $ nledo = $ ( nke a ). scrollspy ( 'refresh' )
  3. }

Nhọrọ

Enwere ike ịfefe nhọrọ site na njirimara data ma ọ bụ Javascript. Maka njirimara data, tinye aha nhọrọ na data-, dị ka ọ dị na data-offset="".

Aha ụdị ndabara nkọwa
nkwụsị nọmba 10 Pikselụ ka a ga-esi n'elu pụta mgbe ị na-agbakọ ọnọdụ mpịakọta.

Ihe omume

Ihe omume Nkọwa
rụọ ọrụ Ihe omume a na-agba ọkụ mgbe ọ bụla ihe ọhụrụ na-arụ ọrụ site na scrollspy.

Ihe atụ taabụ

Tinye ngwa ngwa taabụ arụ ọrụ ike na transiton site na pane nke ọdịnaya mpaghara, ọbụlagodi site na menu ndọda.

Raw denim eleghị anya ị nụbeghị maka ha jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master sachapụ. Afụ ọnụ cliche tempor, williamsburg carles vegan helvetica. Reprehenderit onye na-egbu anụ retro keffiyeh dreamcatcher synth. Cosby sweta eu banh mi, qui irure terry richardson ex squid. Họrọ ebe salvia cillum iphone. Seitan aliquip quis cardigan uwe ndị America, anụ anụ voluptate bụ isi 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.


Ojiji

Kwado taabụ tabbable site na Javascript (taabụ ọ bụla kwesịrị ịgbalite n'otu n'otu):

  1. $ ( '#myTab a' ). pịa ( ọrụ ( e ) {
  2. e . mgbochiDedfault ();
  3. $ ( nke a ). tab ( 'show' );
  4. })

Ị nwere ike ịgbalite taabụ n'otu n'otu n'ụzọ dị iche iche:

  1. $ ( '#myTab a[href="#profile"]' ). tab ( 'show' ); // Họrọ taabụ n'aha
  2. $ ( '#myTab a: nke mbụ' ). tab ( 'show' ); // Họrọ taabụ mbụ
  3. $ ( '#myTab a: ikpeazụ' ). tab ( 'show' ); // Họrọ taabụ ikpeazụ
  4. $ ( '#myTab li: eq(2) a' ). tab ( 'show' ); // Họrọ taabụ nke atọ (0-indexed)

Akara akara

Ị nwere ike ịgbalite taabụ ma ọ bụ pill navigation na-edeghị Javascript ọ bụla site na ịkọwapụta data-toggle="tab"ma ọ bụ data-toggle="pill"na mmewere. Ịtinye navna nav-tabsklaasị na taabụ ulahụ ga-etinye ụdị taabụ Bootstrap.

  1. <ul klas = "nav nav-tabs" >
  2. <li><a href = "#home" data-toggle = "taabụ" > Ụlọ </a></li>
  3. <li><a href = "#profile" data-toggle = "taabụ" > Profaịlụ </a></li>
  4. <li><a href = "#messages" data-toggle = "taabụ" > Ozi </a></li>
  5. <li><a href = "#settings" data-toggle = "taabụ" > Ntọala </a></li>
  6. </ul>

Ụzọ

$()tab

Na-arụ ọrụ mmemme taabụ na akpa ọdịnaya. Tab kwesịrị inwe ma ọ data-targetbụ ihe hrefezubere iche maka ọnụ akpa na DOM.

  1. <ul klas = "nav nav-tabs" id = "myTab" >
  2. <li class = "ọrụ" ><a href = "#ụlọ" > Ụlọ </a></li>
  3. <li><a href = "#profile" > Profaịlụ </a></li>
  4. <li><a href = "#messages" > Ozi </a></li>
  5. <li><a href = "#settings" > Ntọala </a></li>
  6. </ul>
  7.  
  8. <div class = "taabụ-ọdịnaya" >
  9. <div class = "tab-pane active" id = "ụlọ" > ... </div>
  10. <div class = "tab-pane" id = "profile" > ... </div>
  11. <div class = "tab-pane" id = "ozi" > ... </div>
  12. <div class = "tab-pane" id = "ntọala" > ... </div>
  13. </div>
  14.  
  15. <edemede>
  16. $ ( ọrụ () {
  17. $ ( '#myTab a: ikpeazụ' ). tab ( 'show' );
  18. })
  19. </script>

Ihe omume

Ihe omume Nkọwa
gosi Ihe omume a na-agba ọkụ na ihe ngosi taabụ, mana tupu egosiri taabụ ọhụrụ. Jiri event.targetma event.relatedTargettụọ taabụ nọ n'ọrụ yana taabụ arụ ọrụ gara aga (ọ bụrụ na ọ dị) n'otu n'otu.
egosiri Ihe omume a na-agba ọkụ na ihe ngosi taabụ ka egosiri taabụ. Jiri event.targetma event.relatedTargettụọ taabụ nọ n'ọrụ yana taabụ arụ ọrụ gara aga (ọ bụrụ na ọ dị) n'otu n'otu.
  1. $ ( 'a[data-toggle = "taabụ"]' ). na ( 'gosiri' , ọrụ ( e ) {
  2. e . target // taabụ arụ ọrụ
  3. e . metụtaraTarget // taabụ gara aga
  4. })

Ihe atụ

Site na ngwa mgbakwunye jQuery.tipsy mara mma nke Jason Frame dere; Ntuziaka ngwaọrụ bụ ụdị emelitere, nke anaghị adabere na onyonyo, jiri CSS3 maka eserese, yana njirimara data maka nchekwa aha mpaghara.

Gaa na njikọ dị n'okpuru ka ịhụ ndụmọdụ ndụmọdụ:

Ọkpa ogologo ọkpa next level keffiyeh eleghị anya ị nụbeghị maka ha. Foto ụlọ afụ ọnụ raw denim akwụkwọ ozi vegan messenger akpa stumptown. Ugbo-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit American uwe nwere Terry Richardson vinyl chambray. Ogige ajị agba, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, anọ loko mcsweeney si sachaa vegan chambray. A really ironic artisan whatever keytar , scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral.

Ụzọ anọ


Ojiji

Kpalite ntụnye aka site na Javascript:

  1. $ ( '#ihe atụ' ). Tooltip ( nhọrọ )

Nhọrọ

Enwere ike ịfefe nhọrọ site na njirimara data ma ọ bụ Javascript. Maka njirimara data, tinye aha nhọrọ na data-, dị ka ọ dị na data-animation="".

Aha ụdị ndabara nkọwa
animation boolean eziokwu tinye mgbanwe css fade na ngwungwu ngwaọrụ
html boolean ụgha Fanye html n'ime ngwa ọrụ. Ọ bụrụ ụgha, texta ga-eji usoro jquery tinye ọdịnaya n'ime ụlọ. Jiri ederede ma ọ bụrụ na ị na-echegbu onwe gị maka mwakpo XSS.
ntinye eriri | ọrụ 'n'elu' otu esi edobe ngwa ọrụ - top | ala | aka ekpe | nri
onye nhọpụta eriri ụgha Ọ bụrụ na enyere onye nhọpụta, a ga-ekenye ihe nrịbama ngwaọrụ na ebumnuche ndị akọwapụtara.
aha eriri | ọrụ '' Uru aha ndabara ma ọ bụrụ na mkpado 'aha' adịghị
ịkpalite eriri 'hover' otú Tooltip si akpalite - pịa | hover | lekwasịrị anya | akwụkwọ ntuziaka
igbu oge nọmba | ihe 0

igbu oge igosi na izobe ngwa ọrụ (ms) - anaghị emetụta ụdị mkpali aka

Ọ bụrụ na ewepụtara nọmba, a na-etinye igbu oge na ma zoo/egosi

Nhazi ihe bụ:delay: { show: 500, hide: 100 }

Welie isi elu! Enwere ike ịkọwa nhọrọ maka ndụmọdụ ngwaọrụ n'otu n'otu site na iji njirimara data.

Akara akara

Maka ebumnuche arụmọrụ, Tooltip na Popover data-apis abanyela. Ọ bụrụ na ịchọrọ iji ha naanị ezipụta nhọrọ nhọrọ.

  1. <a href = "#" rel = "tooltip" aha = "ngwaọrụ izizi" > fesa m </a>

Ụzọ

$().tooltip(nhọrọ)

Na-ejikọta onye na-ahụ maka ndụmọdụ ngwaọrụ na mkpokọta mmewere.

.tooltip('show')

Na-ekpughe ngwa ọrụ mmewere.

  1. $ ( '# element' ). Tooltip ( 'show' )

.tooltip('zoo')

Na-ezobe ntụaka ngwa ọrụ mmewere.

  1. $ ( '# element' ). Tooltip ( 'zoo' )

.tooltip('toggle')

Na-atụgharị ihe ntụnye aka nke mmewere.

  1. $ ( '# element' ). Tooltip ( 'ntụgharị' )

.tooltip('bibi')

Na-ezo ma na-ebibi ngwa ọrụ mmewere.

  1. $ ( '# element' ). Tooltip ( 'bibi' )

Ihe atụ

Tinye obere ihe machie nke ọdịnaya, dị ka ndị dị na iPad, na ihe ọ bụla maka ozi nke abụọ nke ụlọ. Chekwaa n'elu bọtịnụ iji kpalite popover. Achọrọ ka etinyere ndụmọdụ ngwaọrụ .

Popover kwụ ọtọ

Nhọrọ anọ dị: n'elu, aka nri, ala na aka ekpe kwadoro.

Popover n'elu

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

Popover aka nri

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

Popover ala

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

Popover ekpe

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

Ọnweghị akara egosiri ka ewepụtara popovers site na Javascript yana ọdịnaya dị n'ime datanjirimara.

Ihe ngosi dị ndụ

Ụzọ anọ


Ojiji

Kwado popovers site na Javascript:

  1. $ ( '#ihe atụ' ). popover ( nhọrọ )

Nhọrọ

Enwere ike ịfefe nhọrọ site na njirimara data ma ọ bụ Javascript. Maka njirimara data, tinye aha nhọrọ na data-, dị ka ọ dị na data-animation="".

Aha ụdị ndabara nkọwa
animation boolean eziokwu tinye mgbanwe css fade na ngwungwu ngwaọrụ
html boolean ụgha Fanye html n'ime popover. Ọ bụrụ ụgha, texta ga-eji usoro jquery tinye ọdịnaya n'ime ụlọ. Jiri ederede ma ọ bụrụ na ị na-echegbu onwe gị maka mwakpo XSS.
ntinye eriri | ọrụ 'ziri ezi' otu esi etinye popover - top | ala | aka ekpe | nri
onye nhọpụta eriri ụgha ọ bụrụ na enyere onye nhọpụta, a ga-ekenye ihe ndị ahọpụtara ngwaọrụ na ebumnuche ndị akọwapụtara
ịkpalite eriri 'pịa' ka esi eme popover - pịa | hover | lekwasịrị anya | akwụkwọ ntuziaka
aha eriri | ọrụ '' Uru aha ndabara ma ọ bụrụ na àgwà 'aha' adịghị
ọdịnaya eriri | ọrụ '' default content value if `data-content` attribute isn't present
delay number | object 0

delay showing and hiding the popover (ms) - does not apply to manual trigger type

If a number is supplied, delay is applied to both hide/show

Object structure is: delay: { show: 500, hide: 100 }

Heads up! Options for individual popovers can alternatively be specified through the use of data attributes.

Markup

For performance reasons, the Tooltip and Popover data-apis are opt in. If you would like to use them just specify a selector option.

Methods

$().popover(options)

Initializes popovers for an element collection.

.popover('show')

Reveals an elements popover.

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

.popover('hide')

Hides an elements popover.

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

.popover('toggle')

Toggles an elements popover.

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

.popover('destroy')

Hides and destroys an element's popover.

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

Example alerts

Add dismiss functionality to all alert messages with this plugin.

Holy guacamole! Best check yo self, you're not looking too good.

Oh snap! You got an error!

Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.

Take this action Or do this


Usage

Enable dismissal of an alert via JavaScript:

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

Markup

Just add data-dismiss="alert" to your close button to automatically give an alert close functionality.

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

Methods

$().alert()

Wraps all alerts with close functionality. To have your alerts animate out when closed, make sure they have the .fade and .in class already applied to them.

.alert('close')

Closes an alert.

  1. $(".alert").alert('close')

Events

Bootstrap's alert class exposes a few events for hooking into alert functionality.

Event Description
close This event fires immediately when the close instance method is called.
closed This event is fired when the alert has been closed (will wait for css transitions to complete).
  1. $('#my-alert').bind('closed', function () {
  2. // do something…
  3. })

Example uses

Do more with buttons. Control button states or create groups of buttons for more components like toolbars.

Stateful

Add data-loading-text="Loading..." to use a loading state on a button.

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

Single toggle

Add data-toggle="button" to activate toggling on a single button.

  1. <button type="button" class="btn" data-toggle="button">Single Toggle</button>

Checkbox

Add data-toggle="buttons-checkbox" for checkbox style toggling on btn-group.

  1. <div class="btn-group" data-toggle="buttons-checkbox">
  2. <button type="button" class="btn">Left</button>
  3. <button type="button" class="btn">Middle</button>
  4. <button type="button" class="btn">Right</button>
  5. </div>

Radio

Add data-toggle="buttons-radio" for radio style toggling on btn-group.

  1. <div class="btn-group" data-toggle="buttons-radio">
  2. <button type="button" class="btn">Left</button>
  3. <button type="button" class="btn">Middle</button>
  4. <button type="button" class="btn">Right</button>
  5. </div>

Usage

Enable buttons via JavaScript:

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

Markup

Data attributes are integral to the button plugin. Check out the example code below for the various markup types.

Options

None

Methods

$().button('toggle')

Toggles push state. Gives the button the appearance that it has been activated.

Heads up! You can enable auto toggling of a button by using the data-toggle attribute.
  1. <button type="button" class="btn" data-toggle="button" ></button>

$().button('loading')

Sets button state to loading - disables button and swaps text to loading text. Loading text should be defined on the button element using the data attribute data-loading-text.

  1. <button type="button" class="btn" data-loading-text="loading stuff..." >...</button>
Heads up! Firefox persists the disabled state across page loads. A workaround for this is to use autocomplete="off".

$().button('reset')

Resets button state - swaps text to original text.

$().button(string)

Resets button state - swaps text to any data defined text state.

  1. <button type="button" class="btn" data-complete-text="finished!" >...</button>
  2. <script>
  3. $('.btn').button('complete')
  4. </script>

About

Get base styles and flexible support for collapsible components like accordions and navigation.

* Requires the Transitions plugin to be included.

Example accordion

Using the collapse plugin, we built a simple accordion style widget:

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
  1. <div class="accordion" id="accordion2">
  2. <div class="accordion-group">
  3. <div class="accordion-heading">
  4. <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
  5. Collapsible Group Item #1
  6. </a>
  7. </div>
  8. <div id="collapseOne" class="accordion-body collapse in">
  9. <div class="accordion-inner">
  10. Anim pariatur cliche...
  11. </div>
  12. </div>
  13. </div>
  14. <div class="accordion-group">
  15. <div class="accordion-heading">
  16. <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
  17. Collapsible Group Item #2
  18. </a>
  19. </div>
  20. <div id="collapseTwo" class="accordion-body collapse">
  21. <div class="accordion-inner">
  22. Anim pariatur cliche...
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. ...

You can also use the plugin without the accordion markup. Make a button toggle the expanding and collapsing of another element.

  1. <button type="button" class="btn btn-danger" data-toggle="collapse" data-target="#demo">
  2. simple collapsible
  3. </button>
  4.  
  5. <div id="demo" class="collapse in"></div>

Usage

Via data attributes

Just add data-toggle="collapse" and a data-target to element to automatically assign control of a collapsible element. The data-target attribute accepts a css selector to apply the collapse to. Be sure to add the class collapse to the collapsible element. If you'd like it to default open, add the additional class in.

To add accordion-like group management to a collapsible control, add the data attribute data-parent="#selector". Refer to the demo to see this in action.

Via JavaScript

Enable manually with:

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

Options

Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-parent="".

Name type default description
parent selector false If selector then all collapsible elements under the specified parent will be closed when this collapsible item is shown. (similar to traditional accordion behavior)
toggle boolean true Toggles the collapsible element on invocation

Methods

.collapse(options)

Activates your content as a collapsible element. Accepts an optional options object.

  1. $('#myCollapsible').collapse({
  2. toggle: false
  3. })

.collapse('toggle')

Toggles a collapsible element to shown or hidden.

.collapse('show')

Shows a collapsible element.

.collapse('hide')

Hides a collapsible element.

Events

Bootstrap's collapse class exposes a few events for hooking into collapse functionality.

Event Description
show This event fires immediately when the show instance method is called.
shown This event is fired when a collapse element has been made visible to the user (will wait for css transitions to complete).
hide This event is fired immediately when the hide method has been called.
hidden This event is fired when a collapse element has been hidden from the user (will wait for css transitions to complete).
  1. $('#myCollapsible').on('hidden', function () {
  2. // do something…
  3. })

Example

A basic, easily extended plugin for quickly creating elegant typeaheads with any form text input.

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

Usage

Via data attributes

Add data attributes to register an element with typeahead functionality as shown in the example above.

Via JavaScript

Call the typeahead manually with:

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

Options

Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-source="".

Name type default description
source array, function [ ] The data source to query against. May be an array of strings or a function. The function is passed two arguments, the query value in the input field and the process callback. The function may be used synchronously by returning the data source directly or asynchronously via the process callback's single argument.
items number 8 The max number of items to display in the dropdown.
minLength number 1 The minimum character length needed before triggering autocomplete suggestions
matcher function case insensitive The method used to determine if a query matches an item. Accepts a single argument, the item against which to test the query. Access the current query with this.query. Return a boolean true if query is a match.
sorter function exact match,
case sensitive,
case insensitive
Method used to sort autocomplete results. Accepts a single argument items and has the scope of the typeahead instance. Reference the current query with this.query.
updater function returns selected item The method used to return selected item. Accepts a single argument, the item and has the scope of the typeahead instance.
highlighter function highlights all default matches Method used to highlight autocomplete results. Accepts a single argument item and has the scope of the typeahead instance. Should return html.

Methods

.typeahead(options)

Initializes an input with a typeahead.

Example

The subnavigation on the left is a live demo of the affix plugin.


Usage

Via data attributes

To easily add affix behavior to any element, just add data-spy="affix" to the element you want to spy on. Then use offsets to define when to toggle the pinning of an element on and off.

  1. <div data-spy="affix" data-offset-top="200">...</div>
Heads up! You must manage the position of a pinned element and the behavior of its immediate parent. Position is controlled by affix, affix-top, and affix-bottom. Remember to check for a potentially collapsed parent when the affix kicks in as it's removing content from the normal flow of the page.

Via JavaScript

Call the affix plugin via JavaScript:

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

Methods

.affix('refresh')

When using affix in conjunction with adding or removing of elements from the DOM, you'll want to call the refresh method:

  1. $('[data-spy="affix"]').each(function () {
  2. $(this).affix('refresh')
  3. });

Options

Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-offset-top="200".

Name type default description
offset number | function | object 10 Pikselụ ka a ga-ewepụ site na ihuenyo mgbe ị na-agbakọ ọnọdụ mpịakọta. Ọ bụrụ na enyere otu nọmba, a ga-etinye nkwụghachi ahụ n'akụkụ abụọ na elu na aka ekpe. Ka ige ntị maka otu ntụzịaka, ma ọ bụ ọtụtụ nkwụghachi pụrụ iche, nyere naanị ihe offset: { x: 10 }. Jiri ọrụ mgbe ịchọrọ ịnye nkwụghachi ike (ọ bara uru maka ụfọdụ atụmatụ na-anabata).