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

Enweghị esemokwu

Mgbe ụfọdụ, ọ dị mkpa iji plugins Bootstrap nwere usoro UI ndị ọzọ. N'ọnọdụ ndị a, ndakọrịta oghere aha nwere ike ime mgbe ụfọdụ. Ọ bụrụ na nke a emee, ị nwere ike ịkpọ .noConflictna ngwa mgbakwunye ịchọrọ iweghachi uru nke.

  1. var bootstrapButton = $ . fn . bọtịnụ . noConflict () // weghachi $.fn.bọtịnụ na uru ekenyere mbụ
  2. $ . fn . bootstrapBtn = bootstrapButton // nye $() .bootstrapBtn arụmọrụ bootstrap.

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 chịkọtara (ma ọ bụ miniified) bootstrap.js , ọ dịghị mkpa ịgụnye nke a-ọ dịlarị.

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 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ịrị 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-ezo modal.

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

Ihe omume

Klas modal Bootstrap na-ekpughe ihe omume ole na ole maka ịbanye n'ime ọ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ụ anya (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 mgbanwe 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 mpaghara n'okpuru ebe ịnya ụgbọ mmiri wee lelee klaasị na-agbanwe agbanwe. 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, 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 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 n'ime ụlọ dịka <div id="home"></div>.

Ụzọ

.scrollspy('refresh')

Mgbe ị na-eji scrollspy yana mgbakwunye ma ọ bụ wepụ ihe ndị sitere 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 ka ị gbanwee site na pane nke ọdịnaya mpaghara, ọbụlagodi site na nchịkọta nhọrọ.

Raw denim eleghị anya ị nụbeghị maka ha jeans 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 nhazi 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 = "profaịlụ" > ... </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.

Maka ebumnuche arụmọrụ, mpio ngwaọrụ na popover data-apis abanyela, nke pụtara na ị ga-ebido ya n'onwe gị .

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ọ

Ndụmọdụ n'ime otu ntinye

Mgbe ị na-eji Tooltips na popovers na otu ntinye Bootstrap, ị ga-edozi containernhọrọ (ederede n'okpuru) iji zere mmetụta ndị achọghị.


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 focus' otú Tooltip si akpalite - pịa | hover | lekwasịrị anya | akwụkwọ ntuziaka. Rịba ama na ikpe gafere na-akpalite mutliple, oghere kewapụrụ, ụdị mkpalite.
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 }

akpa eriri | ụgha ụgha

Na-agbakwunye ntụnye aka na otu mmewerecontainer: 'body'

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

  1. <a href = "#" data-toggle = "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ụ '' uru ọdịnaya ndabara ma ọ bụrụ na njirimara 'data-content' adịghị
igbu oge nọmba | ihe 0

igbu oge igosi na izobe popover (ms) - anaghị etinye aka na ụdị mkpalite 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 }

akpa eriri | ụgha ụgha

Na-agbakwunye popover na otu mmewerecontainer: 'body'

Welie isi elu! Enwere ike ịkọwa nhọrọ maka popovers 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ọ.

Ụzọ

$().popover(nhọrọ)

Na-ebute popovers maka mkpokọta mmewere.

.popover('show')

Na-ekpughe ihe ngosi popover.

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

.popover('zoo')

Na-ezobe ihe nchacha mmapụta.

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

.popover('toggle')

Na-atụgharị ihe ndị mejupụtara popover.

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

.popover('bibi')

Na-ezo ma na-ebibi popover nke mmewere.

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

Ngosipụta ihe atụ

Tinye ọrụ achụpụ na ozi njikere niile na ngwa mgbakwunye a.

Guacamole dị nsọ! Kachasị mma ịlele onwe gị, ị naghị adị oke mma.

Oh snoo! Ị nwetara mperi!

Gbanwee nke a na nke ahụ wee nwaa ọzọ. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.

Mee ihe a Ma ọ bụ mee nke a


Ojiji

Kwado ịchụpụ ọkwa site na Javascript:

  1. $ ( ".ọhụụ" ). njikere ()

Akara akara

Naanị tinye data-dismiss="alert"na bọtịnụ mmechi gị iji nye ọrụ nso nsonye na-akpaghị aka.

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

Ụzọ

$().ọmụma()

Na-eji arụ ọrụ nso kechie ọkwa niile. Iji mee ka ọkwa gị dị ndụ mgbe emechiri emechi, gbaa mbọ hụ na ha etinyelarị ya .fadena .inklas ahụ.

.ọmụma (' nso')

Na-emechi mkpu.

  1. $ ( ".ọhụụ" ). njikere ( 'emechi' )

Ihe omume

Klas njikere Bootstrap na-ekpughe ihe omume ole na ole maka ịbanye n'ime ọrụ njikere.

Ihe omume Nkọwa
nso Ihe omume a na-agba ọkụ ozugbo closea na-akpọ usoro ihe atụ.
mechiri emechi A na-achụpụ ihe omume a mgbe emechiela njikere (ga-echere mgbanwe css ka ọ mezue).
  1. $ ( '#my-alert' ). kechie ( 'emechi' , ọrụ () {
  2. // mee ihe…
  3. })

Ihe atụ eji

Jiri bọtịnụ mee ihe ndị ọzọ. Bọtịnụ njikwa na-ekwu ma ọ bụ mepụta otu bọtịnụ maka ihe ndị ọzọ dị ka ogwe ngwaọrụ.

Ọchịchị

Tinye data-loading-text="Loading..."ka iji ọnọdụ nbudata na bọtịnụ.

  1. < ụdị bọtịnụ = "bọtịnụ" klaasị = "btn btn-primary" data-loading-text = "Na-ebugo..." > Ala na- ebu </button>

Otu ngbanwe

Tinye data-toggle="button"ka ịgbalite toggling n'otu bọtịnụ.

  1. <button type = "bọtịnụ" klaasị = "btn btn-primary" data-toggle = "bọtịnụ" > Otu ngbanwe </button>

Igbe nbanye

Tinye data-toggle="buttons-checkbox"maka ụdị ịgbagharị igbe igbe n'otu btn.

  1. <div class = "btn-group" data-toggle = "bọtịnụ-checkbox" >
  2. <button type = "bọtịnụ" klaasị = "btn btn-primary" > Aka ekpe </button>
  3. <bọtịnụ ụdị = "bọtịnụ" klas = "btn btn-primary" > Nke etiti </button>
  4. <button type = "bọtịnụ" klas = "btn btn-primary" > Right </button>
  5. </div>

Redio

Tinye data-toggle="buttons-radio"maka ụdị ntụgharị redio na otu btn.

  1. <div class = "btn-group" data-toggle = "bọtịnụ-redio" >
  2. <button type = "bọtịnụ" klaasị = "btn btn-primary" > Aka ekpe </button>
  3. <bọtịnụ ụdị = "bọtịnụ" klas = "btn btn-primary" > Nke etiti </button>
  4. <button type = "bọtịnụ" klas = "btn btn-primary" > Right </button>
  5. </div>

Ojiji

Kwado bọtịnụ site na Javascript:

  1. $ ( '.nav-taabụ' ). bọtịnụ ()

Akara akara

Njirimara data bụ ihe dị mkpa na ngwa mgbakwunye bọtịnụ. Lelee koodu ihe atụ dị n'okpuru maka ụdị akara akara dị iche iche.

Nhọrọ

Ọ dịghị

Ụzọ

$().bọtịnụ('ntụgharị')

Tụgharịa steeti. Na-enye bọtịnụ ka ọ dị ka agbanyere ya.

Welie isi elu! Ị nwere ike mee ka bọtịnụ gbanwee akpaaka site na iji data-togglenjirimara.
  1. < ụdị bọtịnụ = "bọtịnụ" klaasị = "btn" data-toggle = "bọtịnụ" > </button>

$().bọtịnụ('loading')

Tọọ ọnọdụ bọtịnụ ka ọ na-ebunye - gbanyụọ bọtịnụ ma gbanwee ederede na ntinye ederede. Ekwesịrị ịkọwapụta ederede na-ebunye na mmewere bọtịnụ site na iji njirimara data data-loading-text.

  1. < ụdị bọtịnụ = "bọtịnụ" klaasị = "btn" data-loading-text = "na-ebunye ihe..." > ... </button>
Welie isi elu! Firefox na-aga n'ihu na ọnọdụ nkwarụ n'ofe ibu ibe . Ihe ngwọta maka nke a bụ iji autocomplete="off".

$().bọtịnụ('tọgharịa')

Tọgharịa steeti bọtịnụ - gbanwee ederede na ederede izizi.

$().bọtịnụ(string)

Tọgharịa steeti bọtịnụ - gbanwee ederede na ọnọdụ ederede akọwapụtara data ọ bụla.

  1. < ụdị bọtịnụ = "bọtịnụ" klaasị = "btn" data-complete-text = "mechara!" > ... </bọtịnụ>
  2. <edemede>
  3. $ ( '.btn' ). bọtịnụ ( 'zuru ezu' )
  4. </script>

Ihe gbasara

Nweta ụdị ntọala yana nkwado na-agbanwe agbanwe maka ihe ndị nwere ike imebi dị ka accordions na igodo.

* Achọrọ ka etinyere ngwa mgbakwunye Transitions.

Ihe atụ accordion

N'iji ngwa mgbakwunye ọdịda, anyị wuru wijetị ụdị accordion dị mfe:

Anim pariatur cliche reprehenderit, onye m eiusmod high life accusamus Terry Richardson na squid. 3 wolf moon officia aute, na-abụghị cupidatat skateboard dolor brunch. Ụgbọala nri quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua tinye nnụnụ na ya squid otu-si kọfị 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 biya farm-to-table, raw denim aesthetic synth nesciunt eleghị anya ị nụbeghị banyere ha ebubo na-adigide VHS.
Anim pariatur cliche reprehenderit, onye m eiusmod high life accusamus Terry Richardson na squid. 3 wolf moon officia aute, na-abụghị cupidatat skateboard dolor brunch. Ụgbọala nri quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua tinye nnụnụ na ya squid otu-si kọfị 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 biya farm-to-table, raw denim aesthetic synth nesciunt eleghị anya ị nụbeghị banyere ha ebubo na-adigide VHS.
Anim pariatur cliche reprehenderit, onye m eiusmod high life accusamus Terry Richardson na squid. 3 wolf moon officia aute, na-abụghị cupidatat skateboard dolor brunch. Ụgbọala nri quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua tinye nnụnụ na ya squid otu-si kọfị 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 biya farm-to-table, raw denim aesthetic synth nesciunt eleghị anya ị nụbeghị banyere ha ebubo na-adigide 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. Otu ihe nwere ike igbakota
  6. </a>
  7. </div>
  8. <div id = "collapseOne" klaasị = "accordion-body dara na" >
  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. Otu ihe nwere ike igbakota
  18. </a>
  19. </div>
  20. <div id = "collapseTwo" klaasị = "accordion-body ọdịda" >
  21. <div class = "accordion-inner" >
  22. Anim pariatur cliche...
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. ...

Ị nwekwara ike iji ngwa mgbakwunye na-enweghị akara accordion. Mee ka bọtịnụ gbanwee ịgbasa na ndakpọ nke ihe ọzọ.

  1. < ụdị bọtịnụ = "bọtịnụ" klas = "btn btn-danger" data-toggle = "collapse" data-target = "#demo" >
  2. mfe ndakpọ
  3. </bọtịnụ>
  4.  
  5. <div id = "demo" klaasị = "daba n'ime" > </div>

Ojiji

Site na njirimara data

Naanị tinye data-toggle="collapse"na a data-targetna mmewere iji nye njikwa nke mmewere nwere ike ịdaba na-akpaghị aka. Àgwà ahụ data-targetna-anabata css ahọpụtara iji tinye ọdịda ahụ. Jide n'aka na ịtinye klas collapseahụ na mmewere nwere ike ịdaba. Ọ bụrụ na ị ga-achọ ka ọ meghee, tinye klaasị agbakwunyere in.

Ka ịgbakwunye njikwa otu accordion dị ka njikwa nwere ike imebi, tinye njirimara data data-parent="#selector". Rụtụ aka na ngosi ngosi ka ịhụ nke a na-arụ ọrụ.

Site JavaScript

Jiri aka jiri:

  1. $ ( ".dakpọ" ). daa ()

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-parent="".

Aha ụdị ndabara nkọwa
nne na nna onye nhọpụta ụgha Ọ bụrụ na ahọpụtara, a ga-emechi ihe niile ga-adakpọ n'okpuru nne na nna akọwapụtara mgbe egosiri ihe a nwere ike ịdaba. (yiri omume accordion omenala)
tụgharịa boolean eziokwu Na-atụgharị ihe nwere ike ịdaba na oku

Ụzọ

.dakpọ (nhọrọ)

Na-eme ka ọdịnaya gị rụọ ọrụ ka ihe nwere ike imebi. Nabata nhọrọ nhọrọ object.

  1. $ ( '#myCollapsible' ). daa ({
  2. toggle : ụgha
  3. })

.dakpọ ('toggle')

Na-atụgharị ihe nwere ike ịdaba ka egosiri ma ọ bụ zoo.

.dakpọ ('show')

Na-egosi mmewere nwere ike ịdaba.

daa('zoo')

Na-ezobe mmewere nwere ike ịdaba.

Ihe omume

Klas ndakpọ Bootstrap na-ekpughe ihe omume ole na ole maka itinye aka n'ọrụ ọdịda.

Ihe omume Nkọwa
gosi Ihe omume a na-agba ọkụ ozugbo showa na-akpọ usoro ihe atụ.
egosiri A na-agbanyụ mmemme a mgbe onye ọrụ mere ka ihe ndakpọ pụtara (ga-echere ntụgharị css ka agwụchaa).
zoo A na-agbapụ ihe omume a ozugbo mgbe hidea na-akpọ usoro ahụ.
zoro ezo A na-agbanyụ mmemme a mgbe ezonarila ihe ndakpọ n'aka onye ọrụ (ga-echere ntụgharị css ka emechaa).
  1. $ ( '#myCollapsible' ). na ( 'zoro ezo' , ọrụ () {
  2. // mee ihe…
  3. })

Ọmụmaatụ

Ngwa mgbakwunye bụ isi, gbatịpụrụ ngwa ngwa maka imepụta ụdị ụdịdị mara mma na ntinye ederede ọ bụla.

  1. < ụdị ntinye = "ederede" data-provide = "ụdị isi" >

Ị ga-achọ ịtọọ autocomplete="off"ka igbochi menu ihe nchọgharị ndabara ka ọ pụta n'elu mwụda ụdịdị Bootstrap.


Ojiji

Site na njirimara data

Tinye njirimara data iji debanye aha ihe mmewere nwere ọrụ typeahead dị ka egosiri na ihe atụ dị n'elu.

Site JavaScript

Jiri aka were kpọọ typeahead:

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

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-source="".

Aha ụdị ndabara nkọwa
isi iyi n'usoro, ọrụ [] Isi mmalite data iji jụọ ajụjụ megide. Nwere ike ịbụ n'usoro nke eriri ma ọ bụ ọrụ. A na-agafe arụmụka abụọ, queryuru dị na mpaghara ntinye na processoku azụ. Enwere ike iji ọrụ a n'otu oge site na iweghachite isi data ozugbo ma ọ bụ n'otu oge site na processotu arụmụka azụghachi azụ.
ihe nọmba 8 Ọnụ ọgụgụ kacha elu nke ihe ga-egosipụta na ndọpụta.
Ogologo nkeji nọmba 1 Ogologo agwa kacha nta achọrọ tupu ịkpalite ntụnye akpaghị aka
onye nkwutọ ọrụ ikpe enweghị mmetụta Usoro eji achọpụta ma ajụjụ ọ dabara otu ihe. Nabata otu arụmụka, itemnke a ga-anwale ajụjụ a. Nweta ajụjụ ugbu a na this.query. Weghachite boolean truema ọ bụrụ na ajụjụ bụ egwuregwu.
nhazi ọrụ kpomkwem egwuregwu,
ikpe nwere mmetụta,
enweghị mmetụta
Usoro eji hazie nsonaazụ akpaaka. Nabata otu arụmụka itemsma nwee oke nke ihe atụ typeahead. Tụtụ aka n'ajụjụ dị ugbu a na this.query.
emelite ọrụ weghachi ihe ahọpụtara Usoro eji weghachi ihe ahọpụtara. Nabata otu arụmụka, itemma nwee oke nke ihe atụ typeahead.
highlighter ọrụ na-akọwapụta egwuregwu ndabara niile Usoro eji eme ka ọ pụta ìhè nsonaazụ akpaaka. Nabata otu arụmụka itemma nwee oke nke ihe atụ typeahead. Kwesịrị ịlaghachi html.

Ụzọ

.typehead(nhọrọ)

Na-ebute ntinye n'isi n'isi.

Ọmụmaatụ

The subnavigation n'aka ekpe bụ a ndụ ngosi nke affix plugin.


Ojiji

Site na njirimara data

Ka ịgbakwunye omume affix ngwa ngwa na mmewere ọ bụla, tinye naanị data-spy="affix"na mmewere ịchọrọ iledo. Mgbe ahụ, jiri offsets kọwapụta mgbe ị ga-atụgharị pinning nke mmewere ma gbanye ma gbanyụọ.

  1. <div data-spy = "affix" data-offset-top = "200" > ... </div>
Welie isi elu! Ị ga-enwerịrị ike ijikwa ọnọdụ nke ihe etinyere na omume nke nne na nna ya. Ọ bụ affix, affix-top, na affix-bottom. Cheta ịlele maka nne ma ọ bụ nna nwere ike daa mgbe mgbakwunye a na-amalite ka ọ na-ewepụ ọdịnaya site na ọsọ nke ibe.

Site JavaScript

Kpọọ ngwa mgbakwunye affix site na Javascript:

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

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-top="200".

Aha ụdị ndabara nkọwa
nkwụsị nọmba | ọrụ | ihe 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ụsị pụrụ iche, nye naanị ihe offset: { x: 10 }. Jiri ọrụ mgbe ịchọrọ ịnye nkwụghachi ike (ọ bara uru maka ụfọdụ atụmatụ na-anabata).