Weta ngwa Bootstrap na ndụ-ugbu a nwere ngwa mgbakwunye jQuery omenala iri na atọ.
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ụ.
Ị 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:
- $ ( '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:
- $ ( 'ahụ' ). gbanyụọ ( '.alert.data-api' )
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.
- $ ( ".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):
- $ ( "#myModal" ). modal () // jiri ndabara malite ya
- $ ( "#myModal" ). modal ({ ahụigodo : ụgha }) // ibido na enweghị ahụigodo
- $ ( "#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')
.
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.
- $ ( '#myModal' ). na ( 'show' , ọrụ ( e ) {
- ọ bụrụ (! data ) laghachi e . preventDefault () // akwụsị modal igosi
- })
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ụ.
Ọmụmaatụ ole na ole nke ngwa mgbakwunye mgbanwe:
A na-ahazi usoro, mana na-agbanwe agbanwe, na-akpalite mkparịta ụka na arụrụ ọrụ kacha nta achọrọ yana ndabara smart.
Modal emepụtara nwere nkụnye eji isi mee, ahụ, na usoro omume n'okpuru ụkwụ.
Otu anụ ahụ mara mma…
- <div class = "modal hide fade" >
- <div class = "modal-header" >
- < ụdị bọtịnụ = "bọtịnụ" klaasị = "emechi" data-dismiss = "modal" aria-hidden = "eziokwu" > & ugboro; </bọtịnụ>
- <h3> Ihe nkụnye eji isi mee </h3>
- </div>
- <div klas = "modal-body" >
- <p> Otu ahụ mara mma… </p>
- </div>
- <div class = "modal-footer" >
- <a href = "#" klaasị = "btn"> Mechie </a> _
- <a href = "#" klas = "btn btn-primary" > Chekwa mgbanwe </a>
- </div>
- </div>
Gbanwee modal site na JavaScript site na ịpị bọtịnụ dị n'okpuru. Ọ ga-adaba ma daa site n'elu ibe ahụ.
- <!-- bọtịnụ iji kpalite modal -->
- <a href = "#myModal" ọrụ = "bọtịnụ" klas = "btn" data-toggle = "modal" > Mwepụta ngosi modal </a>
- <!-- Modal -->
- <div id = "myModal" klas = "modal hide fade" tabindex = "-1" ọrụ = "dialog" aria-labelledby = "myModalLabel" aria-hidden = "eziokwu" >
- <div class = "modal-header" >
- < ụdị bọtịnụ = "bọtịnụ" klaasị = "emechi" data-dismiss = "modal" aria-hidden = "eziokwu" > × </button>
- <h3 id = "myModalLabel" > Ntụnye modal </h3>
- </div>
- <div klas = "modal-body" >
- <p> Otu ahụ mara mma… </p>
- </div>
- <div class = "modal-footer" >
- <button class = "btn" data-dismiss = "modal" aria-hidden = "eziokwu" > Mechie </button>
- <button class = "btn btn-primary" > Chekwa mgbanwe </button>
- </div>
- </div>
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.
- <button type = "bọtịnụ" data-toggle = "modal" data-target = "#myModal" > Mwepụta modal </button>
Kpọọ modal nwere id myModal
nwere otu ahịrị Javascript:
- $ ( '#myModal' ). modal ( 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 static maka 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
|
Na-eme ka ọdịnaya gị rụọ ọrụ dị ka modal. Nabata nhọrọ nhọrọ object
.
- $ ( '#myModal' ). modal ({
- ahụigodo : ụgha
- })
Iji aka na-atụgharị modal.
- $ ( '#myModal' ). modal ( 'ntụgharị' )
Iji aka na-emepe modal.
- $ ( '#myModal' ). modal ( 'show' )
Iji aka na-ezobe modal.
- $ ( '#myModal' ). modal ( 'zoo' )
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 show a 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 hide a 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). |
- $ ( '#myModal' ). na ( 'zoro ezo' , ọrụ () {
- // mee ihe…
- })
Tinye menu ndọda n'ihe fọrọ nke nta ka ọ bụrụ ihe ọ bụla nwere ngwa mgbakwunye a dị mfe, gụnyere navbar, taabụ, na ọgwụ.
Tinye data-toggle="dropdown"
na njikọ ma ọ bụ bọtịnụ ka ịgbanwee mkpọda.
- <div klas = "mkpọda" >
- <a class = "dropdown-toggle" data-toggle = "dropdown" href = "#" > Mbudata </a>
- <ul klaasị = "menu ndọda" ọrụ = "menu" aria-labelledby = "dLabel" >
- ...
- </ul>
- </div>
Iji dobe URL adịghị emebi emebi, jiri data-target
njirimara kama href="#"
.
- <div klas = "mkpọda" >
- <a class = "dropdown-toggle" id = "dLabel" ọrụ = "bọtịnụ" data-toggle = "dobe" data-target = "#" href = "/page.html" >
- Wedaa
- <b klas = "nlekọta" </b>
- </a>
- <ul klaasị = "menu ndọda" ọrụ = "menu" aria-labelledby = "dLabel" >
- ...
- </ul>
- </div>
Kpọọ dropdowns site na Javascript:
- $ ( '.dropdown-toggle' ). dropdown ()
Ọ dịghị
Api mmemme maka ntugharị menus maka ihe navbar enyere ma ọ bụ igodo taabụ.
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.
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.
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.
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.
In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
Keytar twee blog, culpa 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.
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 .nav
akụrụngwa.
- <body data-spy = "mpịakọta" data-target = ".navbar" > ... </ body>
Kpọọ scrollspy site na Javascript:
- $ ( '#navbar' ). scrollspy ()
<a href="#home">home</a>
ga-ederịrị ihe dị n'ime ụlọ dịka
<div id="home"></div>
.
Mgbe ị na-eji scrollspy yana ịgbakwunye ma ọ bụ wepụ ihe ndị dị na DOM, ị ga-akpọ usoro ume ọhụrụ dị ka:
- $ ( '[data-spy="mpịakọta"]' ). nke ọ bụla ( ọrụ () {
- var $ nledo = $ ( nke a ). scrollspy ( 'refresh' )
- }
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 | Nkọwa |
---|---|
rụọ ọrụ | Ihe omume a na-agba ọkụ mgbe ọ bụla ihe ọhụrụ na-arụ ọrụ site na scrollspy. |
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.
Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
Kwado taabụ tabbable site na Javascript (taabụ ọ bụla kwesịrị ịgbalite n'otu n'otu):
- $ ( '#myTab a' ). pịa ( ọrụ ( e ) {
- e . mgbochiDedfault ();
- $ ( nke a ). tab ( 'show' );
- })
Ị nwere ike ịgbalite taabụ n'otu n'otu n'ụzọ dị iche iche:
- $ ( '#myTab a[href="#profile"]' ). tab ( 'show' ); // Họrọ taabụ n'aha
- $ ( '#myTab a: nke mbụ' ). tab ( 'show' ); // Họrọ taabụ mbụ
- $ ( '#myTab a: ikpeazụ' ). tab ( 'show' ); // Họrọ taabụ ikpeazụ
- $ ( '#myTab li: eq(2) a' ). tab ( 'show' ); // Họrọ taabụ nke atọ (0-indexed)
Ị 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 nav
na nav-tabs
klaasị na taabụ ul
ahụ ga-etinye ụdị taabụ Bootstrap.
- <ul klas = "nav nav-tabs" >
- <li><a href = "#home" data-toggle = "taabụ" > Ụlọ </a></li>
- <li><a href = "#profile" data-toggle = "taabụ" > Profaịlụ </a></li>
- <li><a href = "#messages" data-toggle = "taabụ" > Ozi </a></li>
- <li><a href = "#settings" data-toggle = "taabụ" > Ntọala </a></li>
- </ul>
Na-arụ ọrụ mmemme taabụ na akpa ọdịnaya. Tab kwesịrị inwe ma ọ data-target
bụ ihe href
ezubere iche maka ọnụ akpa na DOM.
- <ul klas = "nav nav-tabs" id = "myTab" >
- <li class = "ọrụ" ><a href = "#ụlọ" > Ụlọ </a></li>
- <li><a href = "#profile" > Profaịlụ </a></li>
- <li><a href = "#messages" > Ozi </a></li>
- <li><a href = "#settings" > Ntọala </a></li>
- </ul>
- <div class = "taabụ-ọdịnaya" >
- <div class = "tab-pane active" id = "ụlọ" > ... </div>
- <div class = "tab-pane" id = "profile" > ... </div>
- <div class = "tab-pane" id = "ozi" > ... </div>
- <div class = "tab-pane" id = "ntọala" > ... </div>
- </div>
- <edemede>
- $ ( ọrụ () {
- $ ( '#myTab a: ikpeazụ' ). tab ( 'show' );
- })
- </script>
Ihe omume | Nkọwa |
---|---|
gosi | Ihe omume a na-agba ọkụ na ihe ngosi taabụ, mana tupu egosiri taabụ ọhụrụ. Jiri event.target ma event.relatedTarget tụọ 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.target ma event.relatedTarget tụọ taabụ nọ n'ọrụ yana taabụ arụ ọrụ gara aga (ọ bụrụ na ọ dị) n'otu n'otu. |
- $ ( 'a[data-toggle = "taabụ"]' ). na ( 'gosiri' , ọrụ ( e ) {
- e . target // taabụ arụ ọrụ
- e . metụtaraTarget // taabụ gara aga
- })
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.
Kpalite ntụnye aka site na Javascript:
- $ ( '#ihe atụ' ). Tooltip ( 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, text a 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ụ: |
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ọ.
- <a href = "#" rel = "tooltip" aha = "ngwaọrụ izizi" > fesa m </a>
Na-ejikọta onye na-ahụ maka ndụmọdụ ngwaọrụ na mkpokọta mmewere.
Na-ekpughe ngwa ọrụ mmewere.
- $ ( '# element' ). Tooltip ( 'show' )
Na-ezobe ntụaka ngwa ọrụ mmewere.
- $ ( '# element' ). Tooltip ( 'zoo' )
Na-atụgharị ihe ntụnye aka nke mmewere.
- $ ( '# element' ). Tooltip ( 'ntụgharị' )
Na-ezo ma na-ebibi ngwa ọrụ mmewere.
- $ ( '# element' ). Tooltip ( 'bibi' )
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ụ .
Nhọrọ anọ dị: n'elu, aka nri, ala na aka ekpe kwadoro.
Sed posuere consectetur est na lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est na lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est na lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
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 data
njirimara.
Kwado popovers site na Javascript:
- $ ( '#ihe atụ' ). popover ( 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, text a 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: |
For performance reasons, the Tooltip and Popover data-apis are opt in. If you would like to use them just specify a selector option.
Initializes popovers for an element collection.
Reveals an elements popover.
- $('#element').popover('show')
Hides an elements popover.
- $('#element').popover('hide')
Toggles an elements popover.
- $('#element').popover('toggle')
Hides and destroys an element's popover.
- $('#element').popover('destroy')
Add dismiss functionality to all alert messages with this plugin.
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.
Enable dismissal of an alert via JavaScript:
- $(".alert").alert()
Just add data-dismiss="alert"
to your close button to automatically give an alert close functionality.
- <a class="close" data-dismiss="alert" href="#">×</a>
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.
Closes an alert.
- $(".alert").alert('close')
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). |
- $('#my-alert').bind('closed', function () {
- // do something…
- })
Get base styles and flexible support for collapsible components like accordions and navigation.
* Requires the Transitions plugin to be included.
Using the collapse plugin, we built a simple accordion style widget:
- <div class="accordion" id="accordion2">
- <div class="accordion-group">
- <div class="accordion-heading">
- <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
- Collapsible Group Item #1
- </a>
- </div>
- <div id="collapseOne" class="accordion-body collapse in">
- <div class="accordion-inner">
- Anim pariatur cliche...
- </div>
- </div>
- </div>
- <div class="accordion-group">
- <div class="accordion-heading">
- <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
- Collapsible Group Item #2
- </a>
- </div>
- <div id="collapseTwo" class="accordion-body collapse">
- <div class="accordion-inner">
- Anim pariatur cliche...
- </div>
- </div>
- </div>
- </div>
- ...
You can also use the plugin without the accordion markup. Make a button toggle the expanding and collapsing of another element.
- <button type="button" class="btn btn-danger" data-toggle="collapse" data-target="#demo">
- simple collapsible
- </button>
- <div id="demo" class="collapse in"> … </div>
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.
Enable manually with:
- $(".collapse").collapse()
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 |
Activates your content as a collapsible element. Accepts an optional options object
.
- $('#myCollapsible').collapse({
- toggle: false
- })
Toggles a collapsible element to shown or hidden.
Shows a collapsible element.
Hides a collapsible element.
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). |
- $('#myCollapsible').on('hidden', function () {
- // do something…
- })
The slideshow below shows a generic plugin and component for cycling through elements like a carousel.
- <div id="myCarousel" class="carousel slide">
- <!-- Carousel items -->
- <div class="carousel-inner">
- <div class="active item">…</div>
- <div class="item">…</div>
- <div class="item">…</div>
- </div>
- <!-- Carousel nav -->
- <a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
- <a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
- </div>
...
Call carousel manually with:
- $('.carousel').carousel()
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-
, as in data-interval=""
.
Name | type | default | description |
---|---|---|---|
interval | number | 5000 | The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle. |
pause | string | "hover" | Pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave. |
Initializes the carousel with an optional options object
and starts cycling through items.
- $('.carousel').carousel({
- interval: 2000
- })
Cycles through the carousel items from left to right.
Stops the carousel from cycling through items.
Cycles the carousel to a particular frame (0 based, similar to an array).
Cycles to the previous item.
Cycles to the next item.
Bootstrap's carousel class exposes two events for hooking into carousel functionality.
Event | Description |
---|---|
slide | This event fires immediately when the slide instance method is invoked. |
slid | This event is fired when the carousel has completed its slide transition. |
A basic, easily extended plugin for quickly creating elegant typeaheads with any form text input.
- <input type="text" data-provide="typeahead">
Add data attributes to register an element with typeahead functionality as shown in the example above.
Call the typeahead manually with:
- $('.typeahead').typeahead()
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. |
Initializes an input with a typeahead.
The subnavigation on the left is a live demo of the affix plugin.
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.
- <div data-spy="affix" data-offset-top="200">...</div>
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.
Call the affix plugin via JavaScript:
- $('#navbar').affix()
When using affix in conjunction with adding or removing of elements from the DOM, you'll want to call the refresh method:
- $('[data-spy="affix"]').each(function () {
- $(this).affix('refresh')
- });
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). |