Tliša dikarolo tša Bootstrap bophelong-bjale ka di-plugin tše 13 tša jQuery tša tlwaelo.
Di-plugin di ka akaretšwa ka botee (le ge e le gore tše dingwe di na le dilo tšeo di nyakago go ithekga), goba ka moka ka nako e tee. Bobedi bootstrap.js le bootstrap.min.js di na le di-plugin ka moka ka faeleng e tee.
O ka šomiša di-plugin ka moka tša Bootstrap ka go hlweka ka API ya go swaya ntle le go ngwala mola o tee wa JavaScript. Ye ke API ya maemo a pele ya Bootstrap gomme e swanetše go ba go naganelwa ga gago ga mathomo ge o diriša plugin.
Seo se boletšwe, maemong a mangwe go ka ba mo go kganyogegago go tima mošomo wo. Ka hona, re boetse re fana ka bokgoni ba ho thibela ya data tšobotsi API ka unbinding liketsahalo tsohle ka 'mele namespaced le `'data-api'`. Se se lebelega ka tsela ye:
- $ ( 'mmele' ). tima ( '.data-api' ) .
Ka go fapana le moo, go nepiša plugin ye e itšego, akaretša fela leina la plugin bjalo ka sekgoba sa maina gotee le sekgoba sa maina sa data-api ka tsela ye:
- $ ( 'mmele' ). tima ( '.temošo.data-api' ) .
Re dumela gape gore o swanetše go kgona go diriša di-plugin ka moka tša Bootstrap feela ka JavaScript API. Di-API ka moka tša setšhaba ke mekgwa e tee, yeo e ka tsenywago diketane, gomme e bušetša kgoboketšo yeo e dirilwego ka yona.
- $ ( ".btn.kotsi" ). konopo ( "toggle" ). addClass ( "mafura" ) .
Mekgwa ka moka e swanetše go amogela selo sa dikgetho tša boikhethelo, thapo yeo e nepišago mokgwa wo o itšego, goba go se be le selo (yeo e thomago polaka ka boitshwaro bja go se fetoge):
- $ ( "#Modal ya ka" ). modal () // e thomilwe ka di-default
- $ ( "#Modal ya ka" ). modal ({ khiboto : maaka }) // e thomilwe ka ha ho khiboto
- $ ( "#Modal ya ka" ). modal ( 'bontšha' ) // e thoma le go bitša pontšho ka pela
Plugin ye nngwe le ye nngwe gape e pepentšha moagi wa yona wo tala godimo ga thepa ya `Moagi`: $.fn.popover.Constructor
. Ge o rata go hwetša mohlala wo o itšego wa plugin, o e bušetše thwii go tšwa go elemente: $('[rel=popover]').data('popover')
.
Ka dinako tše dingwe go a nyakega go diriša di-plugin tša Bootstrap le ditlhako tše dingwe tša UI. Maemong a, dithulano tša sekgoba sa maina di ka direga ka dinako tše dingwe. Ge se se direga, o ka bitša .noConflict
plugin yeo o nyakago go bušetša boleng bja yona.
- var Konopo ya bootstrap = $ . fn . konopo ya . noConflict () // bušetša $.fn.button go boleng bjo bo abetšwego peleng
- $ . fn . bootstrapBtn = bootstrapButton // fana ka $ (). bootstrapBtn tshebetso ya bootstrap
Bootstrap e fana ka ditiragalo tša tlwaelo bakeng sa bontši bja ditiro tše di kgethegilego tša plugin. Ka kakaretšo, tše di tla ka mokgwa wa go se fele le wa lediri la nakong ye e fetilego - moo lediri la go se fele (ex. show
) le hlohleletšwago mathomong a tiragalo, gomme sebopego sa lona sa lediri la nakong ye e fetilego (ex. shown
) e hlohleletša ge tiro e phethilwe.
Ditiragalo ka moka tša go se fele di fa mošomo wa preventDefault. Se se fa bokgoni bja go emiša phethagatšo ya tiro pele e thoma.
- $ ( '#Modal ya ka' ). ka ( 'bontša' , mosebetsi ( e ) {
- ge e ba (! ya data ) khutlela e . preventDefault () // e emiša modal go bontšhwa
- }) .
Bakeng sa diphetho tše bonolo tša phetogo, akaretša bootstrap-transition.js gatee go bapa le difaele tše dingwe tša JS. Ge e ba o diriša bootstrap.js yeo e kgobokeditšwego (goba yeo e fokoditšwego) , ga go nyakege gore o akaretše se—se šetše se le gona.
Mehlala e mmalwa ya plugin ya phetogo:
Di-modal di nolofaditšwe, eupša di feto-fetoga, di kgopela poledišano ka bonnyane bjo bo nyakegago bja mošomo le dilo tše di sa fetogego tše bohlale.
Modal ye e tšweleditšwego ka hlogo, mmele, le sete ya ditiro ka go letlakala la ka fase.
Mmele o tee o mobotse...
- <div sehlopha = "modal pata fifala" >
- <div sehlopha = "modal-hlooho" >
- < mofuta wa konopo = "konopo" sehlopha = "tswalela" ya data-dismiss = "modal" aria-hidden = "nete" > &nako; </konope>
- <h3> Hlogo ya modale </h3>
- </div> e
- <div sehlopha = "modal-mmele" >
- <p> Mmele o tee o mobotse... </p>
- </div> e
- <div sehlopha = "modal-footer" >
- <a href = "#" sehlopha = "btn" > Tswala </a>
- <a href = "#" class = "btn btn-primary" > Boloka diphetogo </a>
- </div> e
- </div> e
Toggle a modal ka JavaScript ka ho tobetsa konopo e ka tlase. E tla thelela fase gomme ya fifala ka gare go tšwa godimo ga letlakala.
- <!-- Konopo ya go hlohleletša modal -->
- <a href = "#myModal" karolo = "konope" sehlopha = "btn" data-toggle = "modal" > Thoma mokgwa wa demo </a>
- <!-- Modal -->
- <div id = "myModal" sehlopha = "modal pata fifala" tabindex = "-1" karolo = "poledisano" aria-labelledby = "myModalLabel" aria-patilwe = "nete" >
- <div sehlopha = "modal-hlooho" >
- < mofuta wa konopo = "konopo" sehlopha = "tswala" ya data-dismiss = "modal" aria-hidden = "nete" > × </konopo>
- <h3 id = "myModalLabel" > Hlogo ya mokgwa </h3>
- </div> e
- <div sehlopha = "modal-mmele" >
- <p> Mmele o tee o mobotse... </p>
- </div> e
- <div sehlopha = "modal-footer" >
- < sehlopha sa konopo = "btn" ya data-dismiss = "modal" aria-hidden = "nete" > Tswala </konopo>
- <button class = "btn btn-primary" > Boloka diphetogo </konope>
- </div> e
- </div> e
Dira gore modal e šome ntle le go ngwala JavaScript. Beakanya data-toggle="modal"
godimo ga elemente ya molaodi, go swana le konope, gotee le data-target="#foo"
goba href="#foo"
go nepiša modal ye e itšego go fetola.
- < mohuta wa konope = "konope" ya data-toggle = "modal" ya data-sepheo = "#myModal" > Thoma modal </konopo>
Bitsa modal ka id myModal
ka mola o le mong oa JavaScript:
- $ ( '#Modal ya ka' ). modal ( dikgetho ) .
Dikgetho di ka fetišwa ka dika tša datha goba JavaScript. Bakeng sa dika tša datha, tlaleletša leina la kgetho go data-
, bjalo ka go data-backdrop=""
.
Leina | mohuta | hlokomologa | tlhalošo |
---|---|---|---|
lemorago la ka morago | boolean ya go swana | nnete | E akaretša elemente ya modal-backdrop. Ka go fapana le moo, laetša static bakeng sa backdrop yeo e sa tswalelego modal ka go klika. |
khiiboto ya | boolean ya go swana | nnete | E tswalela modal ge senotlelo sa go tšhaba se tobetšwe |
bontšha | boolean ya go swana | nnete | E bontšha modal ge e thongwa. |
kgole | tsela | maaka | Ge e le gore url ya kgole e filwe, diteng di tla imelwa ka
|
E dira gore diteng tša gago di šome bjalo ka modal. E amogela dikgetho tša boikhethelo object
.
- $ ( '#Modal ya ka' ). modal ({ ) .
- khiiboto : maaka
- }) .
Ka seatla e fetola modal.
- $ ( '#Modal ya ka' ). modal ( 'go fetola' ) .
Ka letsoho bula e modal.
- $ ( '#Modal ya ka' ). modal ( 'bontša' ) .
Ka letsoho pata e modal.
- $ ( '#Modal ya ka' ). modal ( 'pata' ) .
Bootstrap o modal sehlopha pepesa liketsahalo tse seng kae bakeng sa hooking ka modal tshebetso.
Tiragalo | Tlhalošo |
---|---|
bontšha | Tiragalo ye e thunya ka pela ge show mokgwa wa mohlala o bitšwa. |
e bontšhitšwe | Tiragalo ye e thuntšhwa ge modal e dirilwe gore e bonagale go mosediriši (e tla emela gore diphetogo tša css di phethe). |
fihla | Tiragalo ye e thuntšhwa ka pela ge hide mokgwa wa mohlala o biditšwe. |
fihlilwe | Tiragalo ye e thuntšhwa ge modal e feditše go utollwa go tšwa go mosediriši (e tla emela gore diphetogo tša css di phethe). |
- $ ( '#Modal ya ka' ). ka ( 'e patiloeng' , mosebetsi () {
- // dira se sengwe...
- }) .
Oketša dimenu tša go theoga go mo e nyakilego go ba selo le ge e le sefe ka plugin ye e bonolo, go akaretša le navbar, dithepo le dipilisi.
Oketša data-toggle="dropdown"
go kgokagano goba konope go fetoša go theoga.
- <div sehlopha = "dropdown" >
- <a class = "dropdown-toggle" data-toggle = "go theoga" href = "#" > Sehlohleletši sa go theoga </a>
- <ul sehlopha = "thepo ya go theoga" tema = "menu" aria-labelledby = "dLabel" >
- ...
- </ul>
- </div> e
Go boloka di-URL di sa senyega, diriša data-target
seka go e na le href="#"
.
- <div sehlopha = "dropdown" >
- <a sehlopha = "go theoga-go fetola" id = "dLabel" tema = "konope" ya data-toggle = "go theoga" ya data-sepheo = "#" href = "/letlakala.html" >
- Dropdown ya go theoga
- <b sehlopha = "caret" </b>
- </a>
- <ul sehlopha = "thepo ya go theoga" tema = "menu" aria-labelledby = "dLabel" >
- ...
- </ul>
- </div> e
Bitša di-drolodown ka JavaScript:
- $ ( '.go theoga-go fetola' ). go theoga () .
Ga go selo
Api ya lenaneo bakeng sa go fetola dimenu bakeng sa navbar e filwego goba go sepelasepela mo go nago le dithepo.
The ScrollSpy plugin ke bakeng sa ka tsela e iketsang ntjhafatsa nav diphetho thehiloeng scroll boemo. Scroll lefelo ka fase ga navbar gomme o lebelele phetogo ya sehlopha se se šomago. Diaetheme tša ka fasana tša go theoga di tla hlaolwa gape.
Ad leggings keytar, brunch id bonono mokga dolor labore. Pitchfork yr enim lo-fi pele ba rekisa qui. Tumblr polasa-ho-tafoleng baesekele ditokelo eng kapa eng. Anim keffiyeh carles cardigan ya go swana le yona. Velit seitan mcsweeney o photo photo photo lephephe 3 phiri ngwedi irure. Cosby jesi lomo jean shorts, williamsburg hoodie minim qui mohlomong ha ua utloa ka bona et cardigan letlole la tšepo culpa biodiesel wes anderson botsebi. Nihil tattooed accusamus, cred kgegeo biodiesel keffiyeh mosebetsi oa matsoho ullamco consequat.
Veniam marfa ditedu skateboard, adipisicing fugiat velit ditedu tša foroko ya pitchfork. Freegan ditedu aliqua cupidatat vero ya mcsweeney. Cupidatat ba bane loko nisi, ea helvetica nulla carles. Tattooed cosby jesi lijo teraka, mcsweeney o quis bao e seng freegan vinyl. Lo-fi wes anderson +1 seaparo sa go robala. Carles bao e seng botsebi boitšhidullo quis gentrify. Brooklyn adipisicing mesebetsi ea matsoho biri motlatsi keytar deserunt.
Occaecat commodo ya go swana le ya go swana le ya delectus. Fap mesebetsi ea matsoho biri deserunt skateboard ea. Lomo baesekele ditokelo adipisicing banh mi, velit ea sunt boemo bo latelang locavore e le 'ngoe-tšimoloho kofi ka magna veniam. Bophelo bo phahameng id vinyl, echo phakeng consequat quis aliquip banh mi foroko ea pitchfork. Vero VHS est go godiša. Consectetur nisi DIY bonyane mokotla wa moromiwa. Cred ex ka, tšoarellang delectus consectetur fanny pakete 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 mokotla wa moromiwa marfa eng kapa eng delectus lijo teraka. Sapiente synth id assumenda. Locavore sed helvetica cliche kgegeo, thundercats mohlomong ha ua utloa ka bona consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat pele ba rekisa, terry richardson proident brunch nesciunt quis cosby jesi pariatur keffiyeh ut helvetica mosebetsi oa matsoho. Cardigan mesebetsi ea matsoho biri seitan readymade velit. VHS chambray laboris veniam ya nakwana. Anim mollit minima commodo ullamco dikatse tsa diaduma.
Go oketša gabonolo boitshwaro bja scrollspy go go sepelasepela ga gago ga topbar, oketša feela data-spy="scroll"
go elemente yeo o nyakago go e hlola (ka tlwaelo kudu se e tla ba mmele) le data-target=".navbar"
go kgetha gore ke nav efe yeo o tlago go e diriša. O tla nyaka go šomiša scrollspy ka .nav
karolo.
- <mmele ya data-spy = "phetola" ya data-sepheo = ".navbar" > ... </mmele>
Bitsa scrollspy ka JavaScript:
- $ ( '# navbar' ). scrollspy () .
<a href="#home">home</a>
swanetše go sepelelana le selo se sengwe ka dom go swana le
<div id="home"></div>
.
Ge o diriša scrollspy ka kopanelo le go tlaleletša goba go tloša dielemente go tšwa go DOM, o tla swanelwa ke go bitša mokgwa wa go hlabolla go swana le bjalo:
- $ ( '[data-spy = "phetola"]' ). e mong le e ( mosebetsi () { .
- var $ sehloela = $ ( ena ). scrollspy ( 'tlhabolla' ) .
- });
Dikgetho di ka fetišwa ka dika tša datha goba JavaScript. Bakeng sa dika tša datha, tlaleletša leina la kgetho go data-
, bjalo ka go data-offset=""
.
Leina | mohuta | hlokomologa | tlhalošo |
---|---|---|---|
offset | nomoro | 10. | Dipiksele go offset go tšwa godimo ge o bala boemo bja go phurolla. |
Tiragalo | Tlhalošo |
---|---|
tsenya tirišong | Tiragalo ye e a tuka neng le neng ge selo se sefsa se thoma go šoma ke scrollspy. |
Oketša mošomo wa thepo ya ka pela, ye e fetogago go phetogo ka diphanephe tša diteng tša selegae, gaešita le ka dimenu tša go theoga.
Raw denim mohlomongwe ga se wa kwa ka bona jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth mong'a hloekisa. Ditedu cliche nakwana, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh mohlapetši wa ditoro synth. Cosby jesi eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone.. Ke nyaka go nyoba nnywana ya mosadi. Seitan aliquip quis cardigan liaparo tsa american, butcher voluptate nisi qui.
Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.
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.
Kgontšha dithepo tša dithepo ka JavaScript (thepo ye nngwe le ye nngwe e swanetše go tsenywa tirišong ka botee):
- $ ( '#Tab ya ka a' ). klika ( mosebetsi ( e ) { .
- e . thibelaDefault ();
- $ ( ena ). tab ( 'bontša' );
- }) .
O ka tsenya tirišong dithepo ka botee ka ditsela tše mmalwa:
- $ ( '# Tab ya ka a [href="#profaele"]' ). tab ( 'bontša' ); // Kgetha tab ka lebitso
- $ ( '#Tab ya ka a:pele' ). tab ( 'bontša' ); // Kgetha tab ya pele
- $ ( '# Tab ya ka a: ya mafelelo' ). tab ( 'bontša' ); // Kgetha tab ya ho qetela
- $ ( '# Tab ya ka li: eq (2) a' ). tab ( 'bontša' ); // Kgetha tab ya boraro (0-indexed) .
O ka tsenya tirišong go sepelasepela ga thepo goba pilisi ntle le go ngwala JavaScript efe goba efe ka go fo laetša data-toggle="tab"
goba data-toggle="pill"
godimo ga elemente. Go tlaleletša diklase tša nav
le nav-tabs
go thepo go ul
tla diriša setaele sa thepo ya Bootstrap.
- <ul sehlopha = "nav nav-dithepo" >
- <li><a href = "#gae" data-toggle = "thepo" > Gae </a></li>
- <li><a href = "#profaele" data-toggle = "thepo" > Profaele </a></li>
- <li><a href = "#melaetša" data-toggle = "thepo" > Melaetša </a></li>
- <li><a href = "#dipeakanyo" data-toggle = "thepo" > Dipeakanyo </a></li>
- </ul>
E tsenya tirišong elemente ya thepo le setshelo sa diteng. Tab e swanetše go ba le e ka ba a data-target
goba a go href
nepiša noutu ya setshelo ka go DOM.
- <ul sehlopha = "nav nav-dithepo" id = "Tab ya ka" >
- <li class = "mafolofolo" ><a href = "#gae" > Gae </a></li>
- <li><a href = "#profaele" > Profaele </a></li>
- <li><a href = "#melaetša" > Melaetša </a></li>
- <li><a href = "#dipeakanyo" > Dipeakanyo </a></li>
- </ul>
- <div sehlopha = "tab-diteng" >
- <div sehlopha = "thepo-lefasetere le sebetsang" id = "gae" > ... </div>
- <div sehlopha = "thepo-lefasetere" id = "profaele" > ... </div>
- <div class = "tab-pane" id = "melaetša" > ... </div>
- <div sehlopha = "tab-pane" id = "dipeakanyo" > ... </div>
- </div> e
- <sengwalwa>
- $ ( mosebetsi () { .
- $ ( '# Tab ya ka a: ya mafelelo' ). tab ( 'bontša' );
- }) .
- </script>
Tiragalo | Tlhalošo |
---|---|
bontšha | Tiragalo ye e thunya ka pontšho ya thepo, eupša pele ga ge thepo ye mpsha e bontšhitšwe. Šomiša event.target le event.relatedTarget go nepiša thepo ye e šomago le thepo ye e šomago ya peleng (ge e le gona) ka go latelelana. |
e bontšhitšwe | Tiragalo ye e thunya pontšhong ya thepo ka morago ga ge thepo e bontšhitšwe. Šomiša event.target le event.relatedTarget go nepiša thepo ye e šomago le thepo ye e šomago ya peleng (ge e le gona) ka go latelelana. |
- $ ( 'a [data-toggle = "thepo"]' ). ka ( 'bontšhitšwe' , mošomo ( e ) { .
- e . sepheo // kenya tshebetsong tab
- e . relatedTarget // thepo ya peleng
- }) .
E hlohleleditšwe ke plugin ye botse kudu ya jQuery.tipsy yeo e ngwadilwego ke Jason Frame; Dikeletšo tša didirišwa ke phetolelo ye e mpshafaditšwego, yeo e sa ithekgego ka diswantšho, e šomiša CSS3 bakeng sa ditshwantšho tša go phela, le dika tša datha bakeng sa polokelo ya thaetlele ya selegae.
Ka mabaka a tshebetso, tooltip le popover data-apis ba kgetha ka, ho bolela hore u lokela ho qala ka bowena .
Beakanya godimo ga dikgokagano tše di lego ka mo tlase go bona ditšhišinyo tša didirišwa:
Tight pants next level keffiyeh mohlomongwe ga se wa kwa ka tšona. Photo lephephe ditedu tala denim letterpress vegan moromiwa mokotla stumptown. Polase-ho-tafoleng seitan, mcsweeney o fixie tšoarellang quinoa 8-bit american liaparo na le terry richardson vinyl chambray. Ditedu stumptown, di-cardigan banh mi lomo dikatse tša diaduma. Tofu biodiesel williamsburg marfa, tse 'nè loko mcsweeney o hloekisa vegan chambray. A hlile ironic artisan eng kapa eng keytar , scenester polasi-ho-tafoleng banksy Austin twitter sebetsana freegan cred tala denim e le 'ngoe-tšimoloho kofi kokoana-hloko.
Ge o šomiša ditšhišinyo tša didirišwa le dipopover ka dihlopha tša tsenyo tša Bootstrap, o tla swanelwa ke go beakanya container
kgetho ya (yeo e ngwadilwego ka mo tlase) go efoga ditlamorago tše di sa nyakegego.
Hlohleletša keletšo ya sedirišwa ka JavaScript:
- $ ( '#mohlala' ). tooltip ( dikgetho ) .
Dikgetho di ka fetišwa ka dika tša datha goba JavaScript. Bakeng sa dika tša datha, tlaleletša leina la kgetho go data-
, bjalo ka go data-animation=""
.
Leina | mohuta | hlokomologa | tlhalošo |
---|---|---|---|
ditshwantsho tse di phelang | boolean ya go swana | nnete | diriša phetogo ya css fade go tooltip |
html | boolean ya go swana | maaka | Tsenya html ka gare ga keletšo ya sedirišwa. Ge e le maaka, mokgwa wa jquery text o tla šomišwa go tsenya diteng ka gare ga dom. Diriša sengwalwa ge e ba o tshwenyegile ka ditlhaselo tša XSS. |
go bewa ga dilo | thapo ya | mošomo | 'godimo' | kamoo ho ka beha tooltip - holimo | tlase | le letšehali | nepagetše |
mokgethi wa go kgetha | thapo | maaka | Ge e le gore mokgethi o filwe, dilo tša keletšo ya sedirišwa di tla abelwa diphetho tše di laeditšwego. |
thaetlele | thapo ya | mošomo | '' . | boleng bja thaetlele ya go se fetoge ge e le gore leswao la `thaetlele` ga le gona |
šušumetša | thapo | 'hover tsepamiso ya maikutlo'. | kamoo tooltip e hlohleletšwago ka gona - tobetsa | hover | go tsepamiša kgopolo | manyuale. Hlokomela o nyeoe feta qholotsa mutliple, sebaka seperated, qholotsa mefuta e. |
diega | nomoro ya | selo | 0. | go diega go bontšha le go uta keletšo ya sedirišwa (ms) - ga e šome go mohuta wa go hlohleletša ka seatla Ge e le gore nomoro e filwe, go diega go dirišwa go bobedi go uta/bontšha Sebopego sa selo ke: |
setshelo | thapo ya | maaka | maaka | E tlaleletša keletšo ya sedirišwa go elemente ye e itšego |
- <a href = "#" data-toggle = "keletšo ya sedirišwa" title = "keletšo ya mathomo ya sedirišwa" > bea godimo ga ka </a>
E kgomaretša sedirišwa sa go swara sedirišwa go kgoboketšo ya elemente.
E utolla keletšo ya sedirišwa ya elemente.
- $ ( '# elemente' ). tooltip ( 'bontša' ) .
E uta keletšo ya sedirišwa ya elemente.
- $ ( '# elemente' ). tooltip ( 'pata' ) .
E fetola keletšo ya sedirišwa ya elemente.
- $ ( '# elemente' ). keletšo ya sedirišwa ( 'toggle' ) .
E uta le go senya sedirišwa sa elemente.
- $ ( '# elemente' ). tooltip ( 'senya' ) .
Oketša dikhupetšo tše nnyane tša dikagare, go swana le tšeo di lego go iPad, go elemente efe goba efe ya go apa tshedimošo ya bobedi. Hover godimo ga konope go hlohleletša popover. E nyaka gore Tooltip e akaretšwe.
Dikgetho tše nne di a hwetšagala: di logagantšwe ka godimo, ka go le letona, ka tlase le ka go le letshadi.
Sed posuere kgethehileng est ka lobortis. Aenean eu leo quam. Pellentesque e kgabišwa ke lacinia quam venenatis vestibulum.
Sed posuere kgethehileng est ka lobortis. Aenean eu leo quam. Pellentesque e kgabišwa ke lacinia quam venenatis vestibulum.
Sed posuere kgethehileng est ka lobortis. Aenean eu leo quam. Pellentesque e kgabišwa ke lacinia quam venenatis vestibulum.
Sed posuere kgethehileng est ka lobortis. Aenean eu leo quam. Pellentesque e kgabišwa ke lacinia quam venenatis vestibulum.
Ga go na go swaya mo go bontšhitšwego bjalo ka di-popover tšeo di tšweleditšwego go tšwa go JavaScript le diteng ka gare ga data
seka.
Kgontšha di-popover ka JavaScript:
- $ ( '#mohlala' ). popover ( dikgetho ) .
Dikgetho di ka fetišwa ka dika tša datha goba JavaScript. Bakeng sa dika tša datha, tlaleletša leina la kgetho go data-
, bjalo ka go data-animation=""
.
Leina | mohuta | hlokomologa | tlhalošo |
---|---|---|---|
ditshwantsho tse di phelang | boolean ya go swana | nnete | diriša phetogo ya css fade go tooltip |
html | boolean ya go swana | maaka | Tsenya html ka gare ga popover. Ge e le maaka, mokgwa wa jquery text o tla šomišwa go tsenya diteng ka gare ga dom. Diriša sengwalwa ge e ba o tshwenyegile ka ditlhaselo tša XSS. |
go bewa ga dilo | thapo ya | mošomo | 'nepagetše' | kamoo ho ka beha popover - holimo | tlase | le letšehali | nepagetše |
mokgethi wa go kgetha | thapo | maaka | ge e le gore mokgethi o filwe, dilo tša keletšo ya sedirišwa di tla abelwa diphetho tše di laeditšwego |
šušumetša | thapo | 'klika'. | kamoo popover e hlohleletšwago ka gona - tobetsa | hover | go tsepamiša kgopolo | manyuale |
thaetlele | thapo ya | mošomo | '' . | boleng bja thaetlele ya go se fetoge ge e le gore seka sa `thaetlele` ga se gona |
diteng | thapo ya | mošomo | '' . | boleng bja diteng tša go se fetoge ge e le gore seka sa `data-content` ga se gona |
diega | nomoro ya | selo | 0. | go diega go bontšha le go uta popover (ms) - ga e šome go mohuta wa go hlohleletša ka seatla Ge e le gore nomoro e filwe, go diega go dirišwa go bobedi go uta/bontšha Sebopego sa selo ke: |
setshelo | thapo ya | maaka | maaka | E tlaleletša popover go elemente ye e itšego |
Ka mabaka a tshepedišo, Tooltip le Popover data-apis di kgetha go tsena Ge o rata go di šomiša e no laetša kgetho ya mokgethi.
E thoma di-popovers bakeng sa kgoboketšo ya elemente.
E senola e elements popover.
- $ ( '# elemente' ). popover ( 'bontša' ) .
Pata e elements popover.
- $ ( '# elemente' ). popover ( 'pata' ) .
Toggles e elements popover.
- $ ( '# elemente' ). popover ( 'go fetola' ) .
Pata le go senya popover ya elemente.
- $ ( '# elemente' ). popover ( 'senya' ) .
Oketša mošomo wa go raka go melaetša ka moka ya temošo ka plugin ye.
Fetoša se le sela gomme o leke gape. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus e dula amet fermentum.
Kgontšha go rakwa ga temošo ka JavaScript:
- $ ( ".temošo" ). temošo () .
E no oketša data-dismiss="alert"
go konope ya gago ya go tswalela go fa ka go iketla mošomo wa go tswalela temošo.
- <a sehlopha = "tswalela" data-dismiss = "temošo" href = "#" > & dinako; </a>
E phuthela ditemošo ka moka ka tšhomišo ya kgauswi. Go dira gore ditemošo tša gago di phele ge di tswaletšwe, kgonthiša gore di na le .fade
le .in
sehlopha seo se šetšego se dirišitšwe go tšona.
E tswalela temošo.
- $ ( ".temošo" ). temošo ( 'tswalela' ) .
Sehlopha sa temošo sa Bootstrap se pepentšha ditiragalo tše mmalwa bakeng sa go goketša mošomong wa temošo.
Tiragalo | Tlhalošo |
---|---|
tswalela | Tiragalo ye e thunya ka pela ge close mokgwa wa mohlala o bitšwa. |
e tswaletšwe | Tiragalo ye e thuntšhwa ge temošo e tswaletšwe (e tla emela gore diphetogo tša css di phethe). |
- $ ( '#temošo ya ka' ). tlama ( 'koaloa' , mosebetsi () {
- // dira se sengwe...
- }) .
Hwetša mekgwa ya motheo le thekgo ye e fetofetogago ya dikarolo tše di phuhlamago go swana le di-accordion le go sepelasepela.
* E nyaka gore plugin ya Diphetogo e akaretšwe.
Ka go diriša plugin ya go phuhlama, re ile ra aga sedirišwa se bonolo sa setaele sa accordion:
- <div sehlopha = "accordion" id = "accordion2" >
- <div sehlopha = "accordion-sehlopha" >
- <div sehlopha = "hlogo ya accordion" >
- <a sehlopha = "accordion-toggle" data-toggle = "ho phuhlama" ya data-motswadi = "# accordion2" href = "# phuhlamaOne" >
- Ntlha ya Sehlopha yeo e ka phuhlamago #1
- </a>
- </div> e
- <div id = "collapseOne" class = "go phuhlama ga mmele wa accordion ka" >
- <div sehlopha = "accordion-ka hare" >
- Anim pariatur cliche ya go swana le yona...
- </div> e
- </div> e
- </div> e
- <div sehlopha = "accordion-sehlopha" >
- <div sehlopha = "hlogo ya accordion" >
- <a sehlopha = "accordion-toggle" data-toggle = "ho phuhlama" ya data-motswadi = "# accordion2" href = "# phuhlamaTwo" >
- Ntlha ya Sehlopha e Phuthelelang #2
- </a>
- </div> e
- <div id = "collapseTwo" sehlopha = "acordion-mmele phuhlama" >
- <div sehlopha = "accordion-ka hare" >
- Anim pariatur cliche ya go swana le yona...
- </div> e
- </div> e
- </div> e
- </div> e
- ...
O ka boela wa sebelisa plugin ntle le accordion markup. Dira gore konope e fetoše go katološa le go phuhlama ga elemente ye nngwe.
- < mofuta wa konopo = "konopo" sehlopha = "btn btn-kotsi" ya data-toggle = "ho phuhlama" ya data-sepheo = "# demo" >
- bonolo collapsible
- </konope>
- <div id = "demo" sehlopha = "phuhlama ka" > ... </div>
E no tlaleletša data-toggle="collapse"
le data-target
go elemente go abela ka go iketla taolo ya elemente ye e phuhlamago. Sebopego data-target
se amogela mokgethi wa css go diriša go phuhlama go yena. Kgonthiša gore o tlaleletša sehlopha collapse
go elemente ye e phuhlamago. Ge e ba o rata gore e bulege ka go ikemela, oketša sehlopha sa tlaleletšo in
.
Go oketša taolo ya sehlopha ya go swana le accordion go taolo ye e phuhlamago, oketša seka sa datha data-parent="#selector"
. Lebelela demo go bona se se šoma.
Kgontšha ka seatla ka:
- $ ( ".e phuhlama" ). go phuhlama () .
Dikgetho di ka fetišwa ka dika tša datha goba JavaScript. Bakeng sa dika tša datha, tlaleletša leina la kgetho go data-
, bjalo ka go data-parent=""
.
Leina | mohuta | hlokomologa | tlhalošo |
---|---|---|---|
motswadi | mokgethi wa go kgetha | maaka | Ge e le gore mokgethi gona dielemente ka moka tše di phuhlamago ka fase ga motswadi yo a laeditšwego di tla tswalelwa ge selo se se se phuhlamago se bontšhwa. (e swanago le boitshwaro bja setšo bja accordion) . |
go fetola | boolean ya go swana | nnete | Toggles elements collapsible ka pitso |
E dira gore diteng tša gago di šome bjalo ka elemente ye e phuhlamago. E amogela dikgetho tša boikhethelo object
.
- $ ( '# e ka phuhlamang ya ka' ). go phuhlama ({
- toggle : maaka
- }) .
E fetola elemente ye e phuhlamago go bontšhwa goba ye e utilwego.
E bontšha elemente yeo e ka phuhlamago.
Pata elemente e phuhlamang.
Sehlopha sa go phuhlama sa Bootstrap se pepentšha ditiragalo tše mmalwa tša go goketša ka mošomo wa go phuhlama.
Tiragalo | Tlhalošo |
---|---|
bontšha | Tiragalo ye e thunya ka pela ge show mokgwa wa mohlala o bitšwa. |
e bontšhitšwe | Tiragalo ye e thuntšhwa ge elemente ya go phuhlama e dirilwe gore e bonagale go modiriši (e tla emela gore diphetogo tša css di phethe). |
fihla | Tiragalo ye e thuntšhwa ka pela ge hide mokgwa o biditšwe. |
fihlilwe | Tiragalo ye e thuntšhwa ge elemente ya go phuhlama e utilwe go tšwa go modiriši (e tla emela gore diphetogo tša css di phethe). |
- $ ( '# e ka phuhlamang ya ka' ). ka ( 'e patiloeng' , mosebetsi () {
- // dira se sengwe...
- }) .
Pontšo ya diselaete ka fase e bontšha plugin ya kakaretšo le karolo ya go sepela ka dipaesekele ka dielemente tša go swana le carousel.
- <div id = "Carousel ya ka" sehlopha = "slide ya carousel" >
- <ol sehlopha = "carousel-ditšhupetšo" >
- <li ya data-sepheo = "#myCarousel" ya data-slide-ho = "0" sehlopha = "mafolofolo" </li>
- <li ya data-sepheo = "#myCarousel" ya data-slide-ho = "1" ></li>
- <li ya data-sepheo = "#myCarousel" ya data-slide-ho = "2" ></li>
- </ol>
- <!-- Dilo tša carousel -->
- <div sehlopha = "carousel-ka hare" >
- <div class = "ntho e sebetsang" > ... </div>
- <div sehlopha = "ntho" > ... </div>
- <div sehlopha = "ntho" > ... </div>
- </div> e
- <!-- Carousel nav -->
- <a sehlopha = "carousel-taolo e letšehali" href = "#Carousel ya ka" data-slide = "pele" > ‹ </a>
- <a sehlopha = "tokelo ya taolo ya carousel" href = "#Carousel ya ka" ya data-slide = "e latelang" > › </a>
- </div> e
Diriša dika tša data go laola gabonolo boemo bja carousel. data-slide
e amogela mantšu a bohlokwa prev
goba next
, yeo e fetošago maemo a selaete ge e bapetšwa le maemo a yona a bjale. Ka go fapana le moo, šomiša data-slide-to
go fetiša tšhupamabaka ya selaete ye tala go carousel data-slide-to="2"
, yeo e tlolago's boemo bja selaete go ya go tšhupamabaka ye e itšego yeo e thomago ka 0
.
Bitsa carousel ka letsoho le:
- $ ( '.kharosele' ). carousel () .
Dikgetho di ka fetišwa ka dika tša datha goba JavaScriptz. Bakeng sa dika tša datha, tlaleletša leina la kgetho go data-
, bjalo ka go data-interval=""
.
Leina | mohuta | hlokomologa | tlhalošo |
---|---|---|---|
sekgoba | nomoro | 5000 e le | Palo ya nako ya go diega magareng ga go sepela ka paesekele ka go itiragalela selo. Ge e ba e le maaka, carousel e ka se dikološe ka go iketla. |
ema nakwana | thapo | "hover" . | E khutša go sepela ka dipaesekele ga carousel go mouseenter gomme e thoma gape go sepela ka dipaesekele ga carousel go mouseleave. |
Initializes carousel le dikgetho boikhethelo object
le qala baesekele ka dintho.
- $ ( '.kharosele' ). carousel ({ ) .
- sekgoba : 2000
- }) .
Didikologa ka dilo tša carousel go tloga go le letshadi go ya go le letona.
E thibela carousel go sepela ka dipaesekele ka dilo.
Cycles carousel ho foreime e itseng (0 e thehiloeng, e tšoanang le hlophisitsoeng).
Didikologo go ya go selo sa go feta.
Didikologo go ya go selo se se latelago.
Sehlopha sa carousel sa Bootstrap se pepentšha ditiragalo tše pedi tša go goketša ka mošomo wa carousel.
Tiragalo | Tlhalošo |
---|---|
selaete | Tiragalo ye e thunya ka pela ge slide mokgwa wa mohlala o bitšwa. |
a thelela | Tiragalo ye e thuntšhwa ge carousel e phethile phetogo ya yona ya diselaete. |
Plugin ya motheo, yeo e katološitšwego gabonolo bakeng sa go hlama ka pela di-typeahead tša maemo ka tsenyo efe goba efe ya sengwalwa sa foromo.
- < mohuta wa tsenyo = "sengwalwa" data-fana = "typeahead" >
O tla nyaka go beakanya autocomplete="off"
go thibela dimenu tša sephephediši tša maitirelo go tšwelela godimo ga go theoga ga Bootstrap typeahead.
Oketša dika tša datha go ngwadiša elemente ka mošomo wa typeahead bjalo ka ge go bontšhitšwe mohlaleng wo o lego ka mo godimo.
Bitša typeahead ka seatla ka:
- $ ( '.thaepa pele' ). typeahead () .
Dikgetho di ka fetišwa ka dika tša datha goba JavaScript. Bakeng sa dika tša datha, tlaleletša leina la kgetho go data-
, bjalo ka go data-source=""
.
Leina | mohuta | hlokomologa | tlhalošo |
---|---|---|---|
mothopo | hlophisitsoeng, mosebetsi | [ ] . | Mothopo wa datha wo o swanetšego go botšiša kgahlanong le wona. E ka ba lenaneo la dithapo goba mošomo. Mošomo o fetišwa dingangišano tše pedi, query boleng ka tšhemong ya go tsenya le process callback. Mošomo o ka šomišwa ka go sepelelana ka go bušetša mothopo wa datha ka go lebanya goba ka go se process swane ka ngangišano e tee ya callback. |
diaetheme | nomoro | 8. | Palo ya godimo ya dilo tšeo di swanetšego go bontšhwa ka go theoga. |
minBolelele | nomoro | 1. 1. | Bonyane bja botelele bja sebopego bjo bo nyakegago pele o hlohleletša ditšhišinyo tša go tlatša ka go itiragalela |
matcher | mošomo | go hloka kwelobohloko ya ditlhaka tše kgolo | Mokgwa wo o šomišwago go bona ge eba potšišo e swana le selo. E amogela ngangišano e tee, item yeo e swanetšego go leka potšišo kgahlanong le yona. Fihlelela potšišo ya bjale ka this.query . Bušetša boolean true ge e le gore potšišo e le go swana. |
mohlophisi | mošomo | go swana ka go nepagala, go se na kwelobohloko ya ditlhaka tše kgolo le ditlhaka tše kgolo |
Mokgwa wo o šomišwago go hlopha dipoelo tša go tlatša ka go itiragalela. E amogela ngangišano e tee items gomme e na le sebaka sa mohlala wa typeahead. Tšhupetšo ya potšišo ya bjale ka this.query . |
sempshafatši | mošomo | e bušetša ntho e kgethilwego | Mokgwa wo o šomišwago go bušetša selo seo se kgethilwego. E amogela ngangišano e tee, ya item le e na le sebaka sa mohlala wa typeahead. |
se hlalositsoeng | mošomo | e gatelela dipapadi ka moka tša go se fetoge | Mokgwa wo o šomišwago go tšweletša dipoelo tša go tlatša ka go itiragalela. E amogela ngangišano e tee item gomme e na le sebaka sa mohlala wa typeahead. E swanetše go bušetša html. |
E thoma tsenyo ka typeahead.
The subnavigation ka le letšehali ke demo e phelang ya plugin ya affix.
Go oketša gabonolo boitshwaro bja go kgomaretša go elemente efe goba efe, e no oketša data-spy="affix"
go elemente yeo o nyakago go e hlola. Ke moka o šomiše di-offset go hlaloša gore o swanetše go fetoša neng go bulela le go tima go kgomaretša ga elemente.
- <div ya data-spy = "kgomaretsa" ya data-offset-top = "200" > ... </div>
affix
,
affix-top
, le
affix-bottom
. Gopola go lekola motswadi yo a ka phuhlamago ge affix e tsena ka ge e tloša diteng go tšwa go phallo ya tlwaelo ya letlakala.
Bitsa plugin ya affix ka JavaScript:
- $ ( '# navbar' ). kgomaretša () .
Dikgetho di ka fetišwa ka dika tša datha goba JavaScript. Bakeng sa dika tša datha, tlaleletša leina la kgetho go data-
, bjalo ka go data-offset-top="200"
.
Leina | mohuta | hlokomologa | tlhalošo |
---|---|---|---|
offset | nomoro ya | mosebetsi | selo | 10. | Dipiksele go offset go tšwa skrineng ge o bala boemo bja go phurolla. Ge e le gore nomoro e tee e filwe, offset e tla dirišwa ka bobedi ka mahlakoreng a godimo le a le letshadi. Go theeletša tlhahlo e tee, goba di-offset tše dintši tša moswananoši, e no nea selo offset: { x: 10 } . Šomiša mošomo ge o nyaka go fa ka maatla offset (yeo e nago le mohola go meralo ye mengwe ye e arabelago). |