JavaScript
Bweretsani zida za Bootstrap kukhala ndi moyo ndi mapulagini opitilira khumi ndi awiri a jQuery. Phatikizani mosavuta onse, kapena m'modzim'modzi.
Bweretsani zida za Bootstrap kukhala ndi moyo ndi mapulagini opitilira khumi ndi awiri a jQuery. Phatikizani mosavuta onse, kapena m'modzim'modzi.
Mapulagini amatha kuphatikizidwa payekhapayekha (pogwiritsa ntchito *.js
mafayilo a Bootstrap), kapena zonse mwakamodzi (pogwiritsa ntchito bootstrap.js
kapena minified bootstrap.min.js
).
Onse bootstrap.js
ndipo bootstrap.min.js
ali ndi mapulagini onse mu fayilo imodzi. Phatikizanipo chimodzi chokha.
Mapulagini ena ndi zigawo za CSS zimadalira mapulagini ena. Ngati muphatikiza mapulagini payekhapayekha, onetsetsani kuti mwayang'ana zodalira izi mu ma docs. Onaninso kuti mapulagini onse amadalira jQuery (izi zikutanthauza kuti jQuery iyenera kuphatikizidwa pamaso pa mafayilo a pulogalamu yowonjezera). Funsani athubower.json
kuti muwone mitundu ya jQuery yothandizidwa.
Mutha kugwiritsa ntchito mapulagini onse a Bootstrap kudzera mu API yamakapu osalemba mzere umodzi wa JavaScript. Iyi ndi API yoyamba ya Bootstrap ndipo iyenera kukhala kuganizira kwanu koyamba mukamagwiritsa ntchito pulogalamu yowonjezera.
Izi zati, nthawi zina zingakhale zofunika kuzimitsa ntchitoyi. Chifukwa chake, timaperekanso kuthekera koletsa API ya data pochotsa zochitika zonse pachikalatacho chokhala ndi dzina data-api
. Izi zikuwoneka motere:
Kapenanso, kuti mulondole pulogalamu yowonjezera, ingophatikizani dzina la plugin ngati malo okhala ndi dzina la data-api monga chonchi:
Osagwiritsa ntchito mawonekedwe a data kuchokera kumapulagini angapo pa chinthu chimodzi. Mwachitsanzo, batani silingakhale ndi chida ndikusinthira modali. Kuti muchite izi, gwiritsani ntchito chinthu chokulunga.
Tikukhulupiriranso kuti muyenera kugwiritsa ntchito mapulagini onse a Bootstrap kudzera mu JavaScript API. Ma API onse omwe ali pagulu ndi amodzi, njira zosinthira, ndikubweza zosonkhanitsa zomwe zachitika.
Njira zonse ziyenera kuvomereza chinthu chosankha, chingwe chomwe chimayang'ana njira inayake, kapena palibe (chomwe chimayambitsa pulogalamu yowonjezera yokhala ndi machitidwe osakhazikika):
Pulagi iliyonse imawululanso womanga wake panyumba Constructor
: $.fn.popover.Constructor
. Ngati mukufuna kupeza pulogalamu yowonjezera, itengereni mwachindunji ku chinthu: $('[rel="popover"]').data('popover')
.
Mutha kusintha makonda a pulogalamu yowonjezera posintha chinthu cha pulogalamu yowonjezera Constructor.DEFAULTS
:
Nthawi zina pamafunika kugwiritsa ntchito mapulagini a Bootstrap okhala ndi ma UI ena. Pazifukwa izi, kugunda kwa mayina kumachitika nthawi zina. Izi zikachitika, mutha kuyitanitsa pulogalamu yowonjezera .noConflict
yomwe mukufuna kubwezeretsanso mtengo wake.
Bootstrap imapereka zochitika zapadera pazochita zapadera za mapulagini ambiri. Nthawi zambiri, izi zimabwera mu mawonekedwe osamalizidwa komanso am'mbuyomu - pomwe mawu osamalitsa (mwachitsanzo. show
) amayambika kumayambiriro kwa chochitika, ndipo mawonekedwe ake apitalo (mwachitsanzo. shown
) amayambika akamaliza kuchitapo kanthu.
Pofika pa 3.0.0, zochitika zonse za Bootstrap zili ndi mayina.
Zochitika zonse zopanda malire zimapereka preventDefault
magwiridwe antchito. Izi zimapereka kuthekera koyimitsa kuchitapo kanthu kusanayambe.
Zida ndi Popovers amagwiritsa ntchito sanitizer yathu yopangira kuti ayeretse zosankha zomwe zimavomereza HTML.
Mtengo whiteList
wokhazikika ndi uwu:
Ngati mukufuna kuwonjezera ma values atsopano pazosintha izi whiteList
mutha kuchita izi:
Ngati mukufuna kulambalala sanitizer yathu chifukwa mumakonda kugwiritsa ntchito laibulale yodzipereka, mwachitsanzo DOMpurify , muyenera kuchita izi:
document.implementation.createHTMLDocument
Ngati asakatuli omwe sakugwirizana ndi document.implementation.createHTMLDocument
, monga Internet Explorer 8, ntchito ya sanitize yomangidwamo imabwezeretsa HTML momwe ilili.
Ngati mukufuna kuchita ukhondo pankhaniyi, chonde tchulani sanitizeFn
ndikugwiritsa ntchito laibulale yakunja monga DOMpurify .
Mtundu wa mapulagini aliwonse a Bootstrap a jQuery atha kupezeka kudzera pamtundu VERSION
wa wopanga pulogalamu yowonjezera. Mwachitsanzo, pa tooltip plugin:
Mapulagini a Bootstrap samabwerera m'mbuyo mwachisomo pomwe JavaScript yazimitsidwa. Ngati mumasamala za ogwiritsa ntchito pankhaniyi, gwiritsani ntchito <noscript>
kufotokoza momwe zinthu ziliri (ndi momwe mungayambitsirenso JavaScript) kwa ogwiritsa ntchito anu, ndi/kapena onjezani zolakwika zanu.
Bootstrap sichirikiza malaibulale a JavaScript a chipani chachitatu monga Prototype kapena jQuery UI. Ngakhale .noConflict
ndi zochitika zotchulidwa mayina, pakhoza kukhala zovuta zogwirizana zomwe muyenera kuzikonza nokha.
Zosavuta kusintha, phatikizani transition.js
kamodzi pamodzi ndi mafayilo ena a JS. Ngati mukugwiritsa ntchito compiled (kapena minified) bootstrap.js
, palibe chifukwa chophatikizira izi - zili kale.
Transition.js ndi mthandizi wofunikira transitionEnd
pazochitika komanso CSS transition emulator. Amagwiritsidwa ntchito ndi mapulagini ena kuti ayang'ane thandizo la kusintha kwa CSS ndikugwira masinthidwe olendewera.
Zosintha zitha kuzimitsidwa padziko lonse lapansi pogwiritsa ntchito mawu a JavaScript otsatirawa, omwe ayenera kubwera transition.js
(kapena bootstrap.js
, bootstrap.min.js
monga momwe zingakhalire) atakwezedwa:
Ma modals amasinthidwa, koma osinthika, ma dialog omwe ali ndi magwiridwe antchito ochepa komanso zosasintha zanzeru.
Onetsetsani kuti musatsegule modal pomwe ina ikuwonekera. Kuwonetsa ma modal opitilira imodzi panthawi kumafuna ma code makonda.
Yesani nthawi zonse kuyika khodi ya HTML ya modal pamalo apamwamba muzolemba zanu kuti mupewe zina zomwe zimakhudza mawonekedwe ndi/kapena magwiridwe antchito a modal.
Pali zidziwitso zina pakugwiritsa ntchito ma modals pazida zam'manja. Onani zolemba zathu zothandizira msakatuli kuti mumve zambiri.
Chifukwa cha momwe HTML5 imafotokozera semantics yake, mawonekedwe a autofocus
HTML alibe mphamvu mu ma modals a Bootstrap. Kuti mukwaniritse zomwezo, gwiritsani ntchito JavaScript yokhazikika:
Mawonekedwe operekedwa okhala ndi mutu, thupi, ndi zochita m'munsimu.
Sinthani modal kudzera pa JavaScript podina batani pansipa. Idzatsika ndikuzimiririka kuchokera pamwamba pa tsamba.
Onetsetsani kuti muwonjezere role="dialog"
ndi aria-labelledby="..."
, kutanthauza mutu wa modal, ku .modal
, ndi role="document"
pawokha .modal-dialog
.
Kuphatikiza apo, mutha kufotokoza za dialog yanu ya modal ndi aria-describedby
pa .modal
.
Kuyika makanema a YouTube mu ma modals kumafuna JavaScript yowonjezera osati mu Bootstrap kuti asiye kusewera ndi zina zambiri. Onani positi yothandiza ya Stack Overflow kuti mumve zambiri.
Ma Modals ali ndi makulidwe awiri osankha, omwe amapezeka kudzera pamagulu osintha kuti ayikidwe pa .modal-dialog
.
Kwa ma mods omwe amangowoneka m'malo mozimiririka kuti awoneke, chotsani .fade
kalasiyo pazolemba zanu.
Kuti mutengere mwayi pagulu la Bootstrap grid mkati mwa modal, ingokhala chisa .row
mkati mwa .modal-body
ndiyeno gwiritsani ntchito makalasi a grid system.
Muli ndi mabatani ambiri omwe amayambitsa modali yofanana, yokhala ndi zosiyana pang'ono? Gwiritsani ntchito event.relatedTarget
ndi mawonekedwe a HTMLdata-*
(mwina kudzera pa jQuery ) kuti musinthe zomwe zili mu modal kutengera batani lomwe ladina. Onani zolemba za Modal Events kuti mudziwe zambiri relatedTarget
,
Pulogalamu yowonjezera ya modal imasintha zinthu zanu zobisika mukafuna, kudzera pa data kapena JavaScript. Imawonjezeranso .modal-open
kusokoneza machitidwe <body>
opukutira osasintha ndikupanga a .modal-backdrop
kuti apereke malo odina kuti muchotse ma modal owonetsedwa mukadina kunja kwa modal.
Yambitsani modali osalemba JavaScript. Khazikitsani data-toggle="modal"
chinthu chowongolera, ngati batani, limodzi ndi data-target="#foo"
kapena href="#foo"
kutsata njira inayake kuti musinthe.
Imbani modal yokhala ndi id myModal
yokhala ndi mzere umodzi wa JavaScript:
Zosankha zitha kuperekedwa kudzera pa data kapena JavaScript. Pamawonekedwe a data, yonjezerani dzina lachisankho ku data-
, monga mu data-backdrop=""
.
Dzina | mtundu | kusakhulupirika | kufotokoza |
---|---|---|---|
kumbuyo | boolean kapena chingwe'static' |
zoona | Mulinso modal-backdrop element. Kapenanso, tchulani static zakumbuyo zomwe sizitseka moduli mukadina. |
kiyibodi | boolean | zoona | Amatseka modali pamene kiyi yothawa ikanikizidwa |
chiwonetsero | boolean | zoona | Imawonetsa modali ikayambika. |
kutali | njira | zabodza | Izi zachotsedwa kuyambira v3.3.0 ndipo zachotsedwa mu v4. M'malo mwake timalimbikitsa kugwiritsa ntchito matempu a kasitomala kapena chimango chomangirira deta, kapena kuyimbira jQuery.load nokha. Ngati ulalo wakutali waperekedwa, zomwe zili mkati zimatsitsidwa nthawi imodzi kudzera munjira ya jQuery |
.modal(options)
Imayambitsa zomwe zili ngati modal. Imavomereza zomwe mungachite object
.
.modal('toggle')
Imatembenuza pamanja modali. Imabwereranso kwa woyimba foniyo isanasonyezedwe kapena kubisidwa (ie zisanachitike shown.bs.modal
kapena hidden.bs.modal
chochitikacho).
.modal('show')
Pamanja amatsegula modali. Imabwereranso kwa woyimba foniyo isanasonyezedwe (ie zisanachitike shown.bs.modal
).
.modal('hide')
Amabisa pamanja modali. Imabwereranso kwa woyimbira foniyo isanabisike (ie zisanachitike hidden.bs.modal
).
.modal('handleUpdate')
Imawongolera momwe ma modal alili kuti athane ndi scrollbar ngati wina angawonekere, zomwe zingapangitse modal kudumpha kumanzere.
Zimangofunika pamene kutalika kwa modal kumasintha pamene ili lotseguka.
Kalasi ya modal ya Bootstrap imawulula zochitika zingapo kuti zigwirizane ndi machitidwe a modal.
Zochitika zonse za modal zimachotsedwa pa modal yokha (ie pa <div class="modal">
).
Mtundu wa Chochitika | Kufotokozera |
---|---|
show.bs.modal | Chochitika ichi chimayaka nthawi yomweyo show njira yachitsanzo itayitanidwa. Ngati chifukwa cha kudina, chinthu chodina chimapezeka ngati relatedTarget katundu wa chochitikacho. |
zowonetsedwa.bs.modal | Chochitikachi chimachotsedwa pamene modal yawonetsedwa kwa wogwiritsa ntchito (idzadikirira kuti kusintha kwa CSS kumalize). Ngati chifukwa cha kudina, chinthu chodina chimapezeka ngati relatedTarget katundu wa chochitikacho. |
hide.bs.modal | Chochitika ichi chimachotsedwa nthawi yomweyo pamene hide njira yachitsanzo yayitanidwa. |
zobisika.bs.modal | Chochitikachi chimachotsedwa pamene modal yatha kubisidwa kwa wogwiritsa ntchito (idikira kuti kusintha kwa CSS kumalize). |
loaded.bs.modal | Chochitikachi chimachotsedwa pamene modal yadzaza zinthu pogwiritsa ntchito remote njirayo. |
Onjezani mindandanda yotsitsa pafupifupi chilichonse ndi pulogalamu yowonjezera iyi, kuphatikiza navbar, ma tabo, ndi mapiritsi.
Pogwiritsa ntchito mawonekedwe a data kapena JavaScript, pulogalamu yowonjezera yotsitsa imasintha zobisika (mindandanda yotsikira) posintha .open
kalasiyo pamndandanda wa makolo.
Pazida zam'manja, kutsegula kutsika kumawonjezera .dropdown-backdrop
ngati malo opopera kuti mutseke mindandanda yotsikira mukadina kunja kwa menyu, chofunikira pakuthandizira koyenera kwa iOS. Izi zikutanthauza kuti kusintha kuchokera pa menyu otsika otsegula kupita kumtundu wina wotsikira kumafuna kudina kowonjezera pa foni yam'manja.
Zindikirani: Makhalidwewa data-toggle="dropdown"
amadaliridwa potseka mindandanda yazakudya pamlingo wogwiritsa ntchito, ndiye ndibwino kuti muzigwiritsa ntchito nthawi zonse.
Onjezani data-toggle="dropdown"
ku ulalo kapena batani kuti musinthe kutsitsa.
Kuti ma URL asungidwe ndi mabatani a ulalo, gwiritsani ntchito data-target
mawuwo m'malo mwa href="#"
.
Imbani zotsitsa kudzera pa JavaScript:
data-toggle="dropdown"
zofunikabeMosasamala kanthu kuti mumayitanira kutsika kwanu kudzera pa JavaScript kapena m'malo mwake mugwiritse ntchito data-api, data-toggle="dropdown"
nthawi zonse imafunika kuti mukhalepo pazoyambitsa zotsitsa.
Palibe
$().dropdown('toggle')
Imatembenuza menyu yotsikira ya navbar yopatsidwa kapena kusakatula kwa tabu.
Zochitika zonse zotsika zimathamangitsidwa ku .dropdown-menu
's parent element.
Zochitika zonse zotsikira zili ndi relatedTarget
chinthu, chomwe mtengo wake ndi chinthu chosinthira nangula.
Mtundu wa Chochitika | Kufotokozera |
---|---|
onetsani.bs.kutsitsa | Chochitika ichi chimayaka nthawi yomweyo njira yachiwonetsero imatchedwa. |
zowonetsedwa.bs.kutsitsa | Chochitikachi chimachotsedwa pamene kutsika kwawonekera kwa wogwiritsa ntchito (kudikira kusintha kwa CSS, kuti kumalize). |
kutsitsa.bs | Chochitikachi chimachotsedwa nthawi yomweyo njira yobisala itayitanidwa. |
zobisika.bs.kutsitsa | Chochitikachi chimachotsedwa pamene kutsitsa kwatha kubisidwa kwa wogwiritsa ntchito (kudikira kusintha kwa CSS, kuti kumalize). |
Pulagi ya ScrollSpy ndi yongosintha zokha za nav kutengera malo opukutira. Sungani malo omwe ali pansi pa navbar ndikuwona kusintha kwa kalasi yogwira. Zinthu zotsikirapo zidzawonetsedwanso.
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi asanagulitse. Ufulu wa njinga zamtundu wa Tumblr zilizonse. Ma cardigan opangidwa ndi manja. Chithunzi cha Velit seitan mcsweeney 3 wolf moon irure. Kabudula wa Cosby lomo wa jean, williamsburg hoodie minim qui mwina simunamvepo za iwo et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
Veniam marfa masharubu skateboard, adipisicing fugiat velit pitchfork ndevu. Freegan ndevu aliqua cupidatat mcsweeney's vero. Cupidatat zinayi loko nisi, ea helvetica nulla carles. Tattooed cosby sweater food truck, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.
Occaecat commodo aliqua deelectus. Fap craft beer 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 ndi adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable deelectus 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 messenger bag marfa whatever delectus food truck. Sapiente synth id guessnda. Locavore sed helvetica cliche irony, mabingu mwina simunawamvepo consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat asanagulitse, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft mowa seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco mabingu.
Maulalo a Navbar akuyenera kukhala ndi ma id omwe angathetsedwe. Mwachitsanzo, <a href="#home">home</a>
ziyenera kugwirizana ndi china chake mu DOM monga <div id="home"></div>
.
:visible
chandamale sizinanyalanyazidweZolinga zomwe sizili :visible
molingana ndi jQuery sizidzanyalanyazidwa ndipo zomwe zikugwirizana nazo sizidzawonetsedwa konse.
Ziribe kanthu njira yoyendetsera, scrollspy imafuna kugwiritsa ntchito position: relative;
chinthu chomwe mukuchizonda. Nthawi zambiri izi ndi <body>
. Pamene scrollspying pa zinthu zina osati <body>
, onetsetsani kukhala ndi height
seti ndi overflow-y: scroll;
ntchito.
Kuti muwonjezere machitidwe a scrollspy pamayendedwe anu apamwamba, onjezani data-spy="scroll"
ku chinthu chomwe mukufuna kuti mukazonde (nthawi zambiri izi zitha kukhala <body>
). Kenako onjezani mawonekedwewo data-target
ndi ID kapena kalasi ya kholo la gawo lililonse la Bootstrap .nav
.
Mukawonjezera position: relative;
CSS yanu, imbani scrollspy kudzera pa JavaScript:
.scrollspy('refresh')
Mukamagwiritsa ntchito scrollspy molumikizana ndi kuwonjezera kapena kuchotsa zinthu mu DOM, muyenera kuyimbira njira yotsitsimutsa motere:
Zosankha zitha kuperekedwa kudzera pa data kapena JavaScript. Pamawonekedwe a data, yonjezerani dzina lachisankho ku data-
, monga mu data-offset=""
.
Dzina | mtundu | kusakhulupirika | kufotokoza |
---|---|---|---|
kuchepetsa | nambala | 10 | Ma pixel oti muyike kuchokera pamwamba powerengera malo osindikizira. |
Mtundu wa Chochitika | Kufotokozera |
---|---|
activate.bs.scrollspy | Chochitikachi chimayaka nthawi iliyonse chinthu chatsopano chikatsegulidwa ndi scrollspy. |
Onjezani magwiridwe antchito a tabu achangu, osinthika kuti musinthe pazigawo zazomwe zili kwanuko, ngakhale kudzera m'mindandanda yotsitsa. Ma tabu okhala ndi zisa sagwiritsidwa ntchito.
denim yaiwisi mwina simunamvepo za iwo akabudula a jean Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan American aarel, 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.
Pulagi iyi imakulitsa gawo loyang'ana la tabbed kuti muwonjezere madera omwe atha kupezeka.
Yambitsani ma tabable kudzera pa JavaScript (tabu iliyonse iyenera kutsegulidwa payekhapayekha):
Mutha kuyambitsa ma tabo amodzi m'njira zingapo:
Mutha kuyambitsa tabu kapena kuyenda kwamapiritsi osalemba JavaScript mwa kungotchulapo data-toggle="tab"
kapena data-toggle="pill"
pa chinthu. Kuonjezera nav
ndi nav-tabs
makalasi pa tabu kudzagwiritsaul
ntchito kalembedwe ka Bootstrap , pamene kuwonjezera ndi makalasi adzagwiritsa ntchito kalembedwe ka mapiritsi .nav
nav-pills
Kuti ma tabo azitha kuzimiririka, onjezani .fade
chilichonse .tab-pane
. Gawo loyamba la tabu liyeneranso .in
kupangitsa kuti zomwe zili zoyamba ziwonekere.
$().tab
Imayatsa chinthu cha tabu ndi chidebe cha zinthu. Tabu iyenera kukhala ndi imodzi data-target
kapena href
yolunjika ku chidebe mu DOM. M'zitsanzo zomwe zili pamwambapa, ma tabu ndi <a>
s okhala ndi mawonekedwe data-toggle="tab"
.
.tab('show')
Imasankha tabu yomwe yaperekedwa ndikuwonetsa zomwe ikugwirizana nazo. Tabu ina iliyonse yomwe idasankhidwa kale imakhala yosasankhidwa ndipo zomwe zikugwirizana nazo zimabisika. Imabwereranso kwa woyimbayo tsamba la tabu lisanasonyezedwe (ie zisanachitike shown.bs.tab
).
Mukawonetsa tabu yatsopano, zochitika zimayaka motere:
hide.bs.tab
(pa tabu yomwe ikugwira ntchito pano)show.bs.tab
(pa tabu yomwe ikuyenera kuwonetsedwa)hidden.bs.tab
(pa tabu yogwira kale, yofanana ndi ya hide.bs.tab
chochitikacho)shown.bs.tab
(pa tabu yomwe yangowonetsedwa kumene, yofanana ndi ya show.bs.tab
chochitikacho)Ngati palibe tabu yomwe idagwira kale, ndiye kuti hide.bs.tab
ndi hidden.bs.tab
zochitika sizidzachotsedwa.
Mtundu wa Chochitika | Kufotokozera |
---|---|
onetsani.bs.tab | Chochitikachi chikuyaka pa tabu chiwonetsero, koma tabu yatsopano isanasonyezedwe. Gwiritsani ntchito event.target ndikuwongolera event.relatedTarget tabu yomwe ikugwira ntchito ndi tabu yogwira kale (ngati ilipo) motsatana. |
chiwonetsero.bs.tab | Chochitika ichi chikuyaka pa tabu chiwonetsero pambuyo poti tabu yawonetsedwa. Gwiritsani ntchito event.target ndikuwongolera event.relatedTarget tabu yomwe ikugwira ntchito ndi tabu yogwira kale (ngati ilipo) motsatana. |
bisa.bs.tab | Chochitikachi chimayaka pomwe tabu yatsopano iyenera kuwonetsedwa (ndipo chifukwa chake tabu yogwira kale iyenera kubisika). Gwiritsani ntchito event.target ndi event.relatedTarget kulunjika tabu yomwe ikugwira ntchito ndi tsamba latsopano lomwe lizigwira ntchito posachedwa, motsatana. |
chobisika.bs.tab | Chochitikachi chimayaka pambuyo poti tabu yatsopano yawonetsedwa (ndipo chifukwa chake tabu yogwira kale yabisika). Gwiritsani event.target ntchito event.relatedTarget ndikulunjika tabu yomwe idagwira kale ndi tabu yatsopano, motsatana. |
Kulimbikitsidwa ndi pulogalamu yowonjezera ya jQuery.tipsy yolembedwa ndi Jason Frame; Tooltips ndi mtundu wosinthidwa, womwe sudalira zithunzi, gwiritsani ntchito CSS3 pa makanema ojambula pamanja, ndi mawonekedwe a data posungira mitu yanu.
Zida zokhala ndi mitu zazitali sizimawonetsedwa.
Yendani pamwamba pa maulalo omwe ali pansipa kuti muwone zida zothandizira:
mathalauza olimba next level keffiyeh mwina simunamvepo. Photo booth ndevu za denim yaiwisi letterpress vegan messenger bag stumptown. Zovala za Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american zovala zili ndi terry richardson vinyl chambray. Ndevu stumptown, ma cardigans banh mi lomo mabingu. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A really artisan artisan whatever keytar , malo owoneka bwino a famu-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral.
Zosankha zinayi zilipo: pamwamba, kumanja, pansi, ndi kumanzere.
Pazifukwa zogwirira ntchito, Tooltip ndi Popover data-apis ndizolowera, kutanthauza kuti muyenera kuziyambitsa nokha .
Njira imodzi yokhazikitsira zida zonse patsamba ingakhale yosankha malinga ndi zomwe ali nazo data-toggle
:
Pulogalamu yowonjezera ya tooltip imapanga zokhutira ndi zolembera zomwe zimafunidwa, ndipo mwachisawawa zimayika zida pambuyo pa zomwe zimayambitsa.
Yambitsani chida kudzera pa JavaScript:
Cholembera chofunikira pa chida ndi mawonekedwe chabe data
ndipo title
pa chinthu cha HTML mukufuna kukhala ndi chida. Zolemba zopangira zida ndizosavuta, ngakhale zimafunikira malo (mwachisawawa, zokhazikitsidwa top
ndi pulogalamu yowonjezera).
Nthawi zina mumafuna kuwonjezera chida ku hyperlink yomwe imakutira mizere ingapo. Khalidwe losasinthika la plugin ya tooltip ndikuyiyika molunjika komanso molunjika. Onjezani white-space: nowrap;
ku anangula anu kuti mupewe izi.
Mukamagwiritsa ntchito zidziwitso pazinthu zomwe zili mkati mwa a .btn-group
kapena .input-group
, kapena zokhudzana ndi tebulo ( <td>
, <th>
, <tr>
, <thead>
, <tbody>
, <tfoot>
), muyenera kufotokoza zomwe mungachite container: 'body'
(zolembedwa pansipa) kuti mupewe zotsatira zosafunikira (monga kukula kwa chinthucho ndi/ kapena kutaya ngodya zake zozungulira pamene chida chayamba).
Kwa ogwiritsa ntchito kiyibodi, makamaka ogwiritsa ntchito matekinoloje othandizira, muyenera kungowonjezera zida kuzinthu zomwe zimayang'ana kwambiri kiyibodi monga maulalo, zowongolera mafomu, kapena china chilichonse chosagwirizana chokhala ndi mawonekedwe tabindex="0"
.
Kuti muwonjezere chida ku chinthu disabled
kapena .disabled
chinthu, ikani chinthucho mkati mwa a <div>
ndikugwiritsa ntchito chidacho <div>
m'malo mwake.
Zosankha zitha kuperekedwa kudzera pa data kapena JavaScript. Pamawonekedwe a data, yonjezerani dzina lachisankho ku data-
, monga mu data-animation=""
.
Dziwani kuti pazifukwa zachitetezo sanitize
, sanitizeFn
ndi whiteList
zosankha sizingaperekedwe pogwiritsa ntchito mawonekedwe a data.
Dzina | Mtundu | Zosasintha | Kufotokozera |
---|---|---|---|
makanema ojambula | boolean | zoona | Ikani kusintha kwa CSS pazida |
chotengera | chingwe | zabodza | zabodza | Imawonjezera chida ku chinthu china. Chitsanzo: |
kuchedwa | nambala | chinthu | 0 | Kuchedwa kusonyeza ndi kubisa chida (ms) - sikugwira ntchito pamanja choyambitsa Ngati nambala yaperekedwa, kuchedwetsa kumayikidwa pazithunzi zonse ziwiri Kapangidwe kachinthu ndi: |
html | boolean | zabodza | Ikani HTML mu chida. Ngati zabodza, text njira ya jQuery idzagwiritsidwa ntchito kuyika zomwe zili mu DOM. Gwiritsani ntchito mawu ngati mukuda nkhawa ndi kuukira kwa XSS. |
kuika | chingwe | ntchito | 'pamwamba' | Momwe mungayikitsire chida - pamwamba | pansi | kumanzere | chabwino | auto. Ntchito ikagwiritsidwa ntchito kudziwa malo, imatchedwa ndi chida cha DOM node ngati mtsutso wake woyamba ndi chinthu choyambitsa DOM node ngati yachiwiri. Nkhaniyi |
wosankha | chingwe | zabodza | Ngati chosankha chaperekedwa, zida zopangira zida zidzaperekedwa ku zomwe zafotokozedwazo. M'malo mwake, izi zimagwiritsidwanso ntchito kugwiritsa ntchito zida zothandizira pazinthu zowonjezera za DOM ( jQuery.on thandizo). Onani izi ndi chitsanzo chodziwitsa . |
template | chingwe | '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' |
Base HTML kuti mugwiritse ntchito popanga chida. The tooltip's adzabayidwa
Chokulunga chakunja chiyenera kukhala ndi |
mutu | chingwe | ntchito | '' | Mtengo wamutu wotsikirapo ngati Ngati ntchito yaperekedwa, idzayitanidwa ndi |
choyambitsa | chingwe | 'hover focus' | Momwe chida chimayambira - dinani | kugwa | kuganizira | buku. Mutha kudutsa zoyambitsa zambiri; alekanitse iwo ndi danga. manual sichingaphatikizidwe ndi choyambitsa china chilichonse. |
malo owonera | chingwe | chinthu | ntchito | { chosankha: 'thupi', padding: 0} | Imasunga chida mkati mwa malire a chinthu ichi. Chitsanzo: Ngati ntchito yaperekedwa, imatchedwa ndi chinthu choyambitsa DOM node ngati mkangano wake wokha. Nkhaniyi |
yeretsani | boolean | zoona | Yambitsani kapena kuletsa ukhondo. Ngati adamulowetsa 'template' , 'content' ndipo 'title' zosankha zidzayeretsedwa. |
whiteList | chinthu | Mtengo wofikira | Chinthu chomwe chili ndi zovomerezeka ndi ma tag |
sanitizeFn | null | ntchito | null | Apa mutha kupereka ntchito yanu ya sanitize. Izi zitha kukhala zothandiza ngati mukufuna kugwiritsa ntchito laibulale yodzipatulira kuchita ukhondo. |
Zosankha za zida zapayekha zitha kufotokozedwa pogwiritsa ntchito mawonekedwe a data, monga tafotokozera pamwambapa.
$().tooltip(options)
Imangiriza chogwirizira ku zida zosonkhanitsira.
.tooltip('show')
Imawulula zida za chinthu. Imabwerera kwa woyimbirayo chida chisanasonyezedwe (ie zisanachitike shown.bs.tooltip
). Izi zimatengedwa ngati "mawu" oyambitsa chida. Zida zokhala ndi mitu zazitali sizimawonetsedwa.
.tooltip('hide')
Imabisa chida cha chinthu. Imabwerera kwa woyimbirayo chida chisanabisike (ie pamaso pahidden.bs.tooltip
). Izi zimatengedwa ngati "mawu" oyambitsa chida.
.tooltip('toggle')
Imatembenuza chida cha chinthu. Imabwerera kwa woyimbirayo chida chisanasonyezedwe kapena kubisidwa (ie chisanachitike shown.bs.tooltip
kapena hidden.bs.tooltip
chochitikacho). Izi zimatengedwa ngati "mawu" oyambitsa chida.
.tooltip('destroy')
Imabisa ndi kuwononga chida cha chinthu. Zida zomwe zimagwiritsa ntchito kugawira ena (omwe amapangidwa pogwiritsa ntchito selector
kusankha ) sizingawonongeke pazigawo zoyambitsa mbadwa.
Mtundu wa Chochitika | Kufotokozera |
---|---|
show.bs.tip | Chochitika ichi chimayaka nthawi yomweyo show njira yachitsanzo itayitanidwa. |
chiwonetsero.bs.tip | Chochitikachi chimachotsedwa pamene chida chawonekera kwa wogwiritsa ntchito (chidikira kuti kusintha kwa CSS kumalize). |
hide.bs.tip | Chochitika ichi chimachotsedwa nthawi yomweyo pamene hide njira yachitsanzo yayitanidwa. |
zobisika.bs.tip | Chochitikachi chimachotsedwa pamene chida chatha kubisidwa kwa wogwiritsa ntchito (chidikira kuti kusintha kwa CSS kumalize). |
inserted.bs.tooltip | Chochitikachi chimachotsedwa pambuyo pa show.bs.tooltip chochitikacho pamene template ya tooltip yawonjezeredwa ku DOM. |
Onjezani zophatikizika zazing'ono, monga zomwe zili pa iPad, kuzinthu zilizonse zachidziwitso chachiwiri.
Ma Popovers omwe mutu wawo ndi zomwe zili zazitali sizimawonetsedwa.
Ma Popover amafuna kuti pulogalamu yowonjezerayo ikhale ndi mtundu wanu wa Bootstrap.
Pazifukwa zogwirira ntchito, Tooltip ndi Popover data-apis ndizolowera, kutanthauza kuti muyenera kuziyambitsa nokha .
Njira imodzi yokhazikitsira ma popovers onse patsamba ingakhale kuwasankha mwamakhalidwe awo data-toggle
:
Mukamagwiritsa ntchito popovers pazinthu zomwe zili mkati mwa a .btn-group
kapena .input-group
, kapena pazinthu zokhudzana ndi tebulo ( <td>
, <th>
, <tr>
, <thead>
, <tbody>
, <tfoot>
), muyenera kufotokoza zomwe mungachite container: 'body'
(zolembedwa pansipa) kuti mupewe zotsatira zosafunikira (monga kukula kwa chinthucho ndi/ kapena kutaya ngodya zake zozungulira pamene popover yayambika).
Kuti muwonjezere popover ku chinthu disabled
kapena .disabled
chinthu, ikani chinthucho mkati mwa a <div>
ndikugwiritsa ntchito popover <div>
m'malo mwake.
Nthawi zina mukufuna kuwonjezera popover ku hyperlink yomwe imakutira mizere ingapo. Khalidwe losasinthika la pulogalamu yowonjezera ya popover ndikuyiyika molunjika komanso molunjika. Onjezani white-space: nowrap;
ku anangula anu kuti mupewe izi.
Zosankha zinayi zilipo: pamwamba, kumanja, pansi, ndi kumanzere.
Sed posuere consectetur est at lobortis. Aenean eu lero quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu lero quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu lero quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu lero quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Gwiritsani ntchito focus
choyambitsa kuti muchotse popover pakadina kotsatira komwe wogwiritsa akupanga.
Kuti mugwiritse ntchito msakatuli woyenera komanso papulatifomu, muyenera kugwiritsa ntchito tag <a>
, osati<button>
tag, komanso muyenera kuphatikiza role="button"
ndi mawonekedwe tabindex
.
Yambitsani popover kudzera pa JavaScript:
Zosankha zitha kuperekedwa kudzera pa data kapena JavaScript. Pamawonekedwe a data, yonjezerani dzina lachisankho ku data-
, monga mu data-animation=""
.
Dziwani kuti pazifukwa zachitetezo sanitize
, sanitizeFn
ndi whiteList
zosankha sizingaperekedwe pogwiritsa ntchito mawonekedwe a data.
Dzina | Mtundu | Zosasintha | Kufotokozera |
---|---|---|---|
makanema ojambula | boolean | zoona | Ikani kusintha kwa CSS fade ku popover |
chotengera | chingwe | zabodza | zabodza | Imawonjezera popover ku chinthu china. Chitsanzo: |
zomwe zili | chingwe | ntchito | '' | Chitsimikizo cha zinthu ngati Ngati ntchito yaperekedwa, |
kuchedwa | nambala | chinthu | 0 | Kuchedwa kusonyeza ndi kubisa popover (ms) - sikugwira ntchito pamanja choyambitsa mtundu Ngati nambala yaperekedwa, kuchedwetsa kumayikidwa pazithunzi zonse ziwiri Kapangidwe kachinthu ndi: |
html | boolean | zabodza | Ikani HTML mu popover. Ngati zabodza, text njira ya jQuery idzagwiritsidwa ntchito kuyika zomwe zili mu DOM. Gwiritsani ntchito mawu ngati mukuda nkhawa ndi kuukira kwa XSS. |
kuika | chingwe | ntchito | 'chabwino' | Momwe mungayikitsire popover - pamwamba | pansi | kumanzere | chabwino | auto. Ntchito ikagwiritsidwa ntchito kudziwa malo, imatchedwa ndi popover DOM node ngati mkangano wake woyamba komanso chinthu choyambitsa DOM node ngati yachiwiri. Nkhaniyi |
wosankha | chingwe | zabodza | Ngati chosankha chaperekedwa, zinthu za popover zidzaperekedwa ku zomwe zafotokozedwazo. M'malo mwake, izi zimagwiritsidwa ntchito kuti zithandizire HTML zomwe zili ndi ma popover awonjezedwe. Onani izi ndi chitsanzo chodziwitsa . |
template | chingwe | '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' |
Base HTML kuti mugwiritse ntchito popanga popover. Ma popover adzabayidwa Ma popover adzabayidwa
Chokulunga chakunja chiyenera kukhala ndi |
mutu | chingwe | ntchito | '' | Mtengo wamutu wotsikirapo ngati Ngati ntchito yaperekedwa, |
choyambitsa | chingwe | 'dinani' | Momwe popover imayambira - dinani | kugwa | kuganizira | buku. Mutha kudutsa zoyambitsa zambiri; alekanitse iwo ndi danga. manual sichingaphatikizidwe ndi choyambitsa china chilichonse. |
malo owonera | chingwe | chinthu | ntchito | { chosankha: 'thupi', padding: 0} | Imasunga kufalikira mkati mwa malire a chinthu ichi. Chitsanzo: Ngati ntchito yaperekedwa, imatchedwa ndi chinthu choyambitsa DOM node ngati mkangano wake wokha. Nkhaniyi |
yeretsani | boolean | zoona | Yambitsani kapena kuletsa ukhondo. Ngati adamulowetsa 'template' , 'content' ndipo 'title' zosankha zidzayeretsedwa. |
whiteList | chinthu | Mtengo wofikira | Chinthu chomwe chili ndi zovomerezeka ndi ma tag |
sanitizeFn | null | ntchito | null | Apa mutha kupereka ntchito yanu ya sanitize. Izi zitha kukhala zothandiza ngati mukufuna kugwiritsa ntchito laibulale yodzipatulira kuchita ukhondo. |
Zosankha za popovers pawokha zitha kufotokozedwa mwanjira ina pogwiritsa ntchito mawonekedwe a data, monga tafotokozera pamwambapa.
$().popover(options)
Imayambitsa ma popover pazosonkhanitsira zinthu.
.popover('show')
Imawulula kuchuluka kwa zinthu. Imabwereranso kwa woyimba foniyo isanawonetsedwe (ie zisanachitike shown.bs.popover
). Izi zimaganiziridwa kuti ndizoyambitsa "kuyambitsa" kwa popover. Ma Popovers omwe mutu wawo ndi zomwe zili zazitali sizimawonetsedwa.
.popover('hide')
Imabisa kuchuluka kwa zinthu. Imabwerera kwa woyimbayo kusanabisike popover (ie pamaso pahidden.bs.popover
). Izi zimaganiziridwa kuti ndizoyambitsa "kuyambitsa" kwa popover.
.popover('toggle')
Imasintha kuphulika kwa chinthu. Imabwereranso kwa woyimba foniyo isanawonetsedwe kapena kubisidwa (ie zisanachitike shown.bs.popover
kapena hidden.bs.popover
chochitikacho). Izi zimaganiziridwa kuti ndizoyambitsa "kuyambitsa" kwa popover.
.popover('destroy')
Imabisa ndikuwononga kufalikira kwa chinthu. Ma Popovers omwe amagwiritsa ntchito kugawira ena (omwe amapangidwa pogwiritsa ntchito selector
mwayi ) sangawonongedwe paokha pazoyambitsa zoyambitsa.
Mtundu wa Chochitika | Kufotokozera |
---|---|
onetsani.bs.popover | Chochitika ichi chimayaka nthawi yomweyo show njira yachitsanzo itayitanidwa. |
zowonetsedwa.bs.popover | Chochitikachi chimachotsedwa pamene popover yawonetsedwa kwa wogwiritsa ntchito (idzadikirira kuti kusintha kwa CSS kumalize). |
bisani.bs.popover | Chochitika ichi chimachotsedwa nthawi yomweyo pamene hide njira yachitsanzo yayitanidwa. |
zobisika.bs.popover | Chochitikachi chimachotsedwa pamene popover yatha kubisidwa kwa wogwiritsa ntchito (idikirira kuti kusintha kwa CSS kumalize). |
anaika.bs.popover | Chochitikachi chimachotsedwa pambuyo pa show.bs.popover chochitikacho pamene template ya popover yawonjezedwa ku DOM. |
Onjezani magwiridwe antchito ku mauthenga onse ochenjeza omwe ali ndi pulogalamu yowonjezera iyi.
Mukamagwiritsa ntchito .close
batani, akuyenera kukhala mwana woyamba .alert-dismissible
ndipo palibe mawu omwe angabwere patsogolo pake.
Sinthani ichi ndi icho ndikuyesanso. Ndife mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.
Ingowonjezerani data-dismiss="alert"
ku batani lanu lakutseka kuti mungopereka chidziwitso chapafupi. Kutseka chenjezo kumachotsa ku DOM.
Kuti zidziwitso zanu zigwiritse ntchito makanema ojambula potseka, onetsetsani kuti zili .fade
ndi .in
makalasi omwe agwiritsidwa ntchito kale.
$().alert()
Imachititsa chidwi kumvetsera zochitika zomwe zimadulidwa pazotsatira zomwe zili ndi tanthauzo data-dismiss="alert"
. (Sizofunikira mukamagwiritsa ntchito data-api's auto-initialization.)
$().alert('close')
Kutseka chenjezo pochotsa mu DOM. Ngati .fade
ndi.in
makalasi alipo pa chinthucho, chenjezo lizimiririka lisanachotsedwe.
Pulogalamu yowonjezera yochenjeza ya Bootstrap imawulula zochitika zingapo kuti zigwirizane ndi ntchito zochenjeza.
Mtundu wa Chochitika | Kufotokozera |
---|---|
close.bs.alert | Chochitika ichi chimayaka nthawi yomweyo close njira yachitsanzo itayitanidwa. |
Closed.bs.alert | Chochitikachi chimachotsedwa pamene chenjezo latsekedwa (lidikira kuti kusintha kwa CSS kumalize). |
Chitani zambiri ndi mabatani. Batani lowongolera likunena kapena pangani magulu a mabatani azinthu zambiri ngati zida.
Firefox imapitilizabe kuwongolera mawonekedwe (kulemala ndi kusanja) pamasamba onse . Njira yothetsera izi ndikugwiritsa ntchito autocomplete="off"
. Onani cholakwika cha Mozilla #654072 .
Onjezani data-loading-text="Loading..."
kuti mugwiritse ntchito potsitsa batani.
Mbali imeneyi yachotsedwa ntchito kuyambira v3.3.5 ndipo yachotsedwa mu v4.
Pachifukwa chachiwonetserochi, tikugwiritsa ntchito data-loading-text
ndi $().button('loading')
, koma si dziko lokhalo lomwe mungagwiritse ntchito. Onani zambiri pa izi pansipa $().button(string)
muzolemba .
Onjezani data-toggle="button"
kuti mutsegule batani limodzi.
.active
ndiaria-pressed="true"
Pamabatani omwe asinthidwa kale, muyenera kuwonjezera .active
kalasi ndi zomwe aria-pressed="true"
mukufuna button
.
Onjezani data-toggle="buttons"
ku .btn-group
bokosi loyang'ana kapena zolowetsa wailesi kuti mutsegule masitayelo awo.
.active
Pazosankha zomwe zasankhidwiratu, muyenera kuwonjezera .active
kalasi pazolowetsa label
nokha.
Ngati chochokonekera cha batani la bokosi lasinthidwa popanda kuwombera click
chochitika pa batani (monga kudzera <input type="reset">
kapena kukhazikitsira zomwe checked
mwalowetsa), muyenera kusintha .active
kalasiyo pazolowetsa label
nokha.
$().button('toggle')
Imatembenuza dziko lokankhira. Imawonetsa batani kuwonekera kuti yayatsidwa.
$().button('reset')
Bwezerani mawonekedwe a batani - kusintha mawu kukhala mawu oyamba. Njirayi ndi yofanana ndipo imabwerera kukonzanso kusanamalize.
$().button(string)
Imasintha mawu kukhala mtundu uliwonse wa mawu.
Flexible plugin yomwe imagwiritsa ntchito makalasi angapo kuti ikhale yosavuta kusintha.
Kugwa kumafuna kuti pulogalamu yowonjezera yosinthira ikhale m'gulu lanu la Bootstrap.
Dinani mabatani omwe ali pansipa kuti muwonetse ndikubisa chinthu china kudzera mukusintha kwamakalasi:
.collapse
amabisa zomwe zili.collapsing
imagwiritsidwa ntchito panthawi ya kusintha.collapse.in
zikuwonetsa zomwe ziliMutha kugwiritsa ntchito ulalo wokhala ndi mawonekedwe href
, kapena batani lokhala ndi tanthauzo data-target
. Muzochitika zonsezi, data-toggle="collapse"
ndikofunikira.
Wonjezerani kugwa kwachisawawa kuti mupange accordion ndi gawo lagawo.
Ndikothekanso kusinthana ndi .panel-body
s ndi .list-group
s.
Onetsetsani kuti muwonjezere aria-expanded
ku chinthu chowongolera. Chizindikirochi chimafotokoza bwino momwe zinthu zomwe zimasokonekera powerenga zowonera ndi matekinoloje othandizira ofanana. Ngati chinthu chogonja chatsekedwa mwachisawawa, chiyenera kukhala ndi mtengo wa aria-expanded="false"
. Ngati mwakhazikitsa chinthu chogonja kuti chitsegulidwe mwachisawawa pogwiritsa ntchito in
kalasi, ikani aria-expanded="true"
pazowongolera m'malo mwake. Pulagiyi imangosintha izi potengera ngati chinthu chogonja chatsegulidwa kapena ayi.
Kuonjezera apo, ngati chinthu chomwe mumayang'anira chikuyang'ana chinthu chimodzi chomwe chimatha kugwa - mwachitsanzo, mawonekedwewo data-target
akulozera kwa id
chosankha - mukhoza kuwonjezera zina aria-controls
pa chinthu chowongolera, chomwe chili ndi id
chinthu chomwe chimatha. Owerenga zenera amakono ndi matekinoloje othandizira ofanana amagwiritsa ntchito izi kuti apatse ogwiritsa ntchito njira zazifupi kuti ayende molunjika ku chinthu chomwe chimasokonekera chokha.
Pulagi yakugwa imagwiritsa ntchito makalasi angapo kuti athetse kukweza kolemera:
.collapse
amabisa zomwe zili.collapse.in
zikuwonetsa zomwe zili.collapsing
imawonjezeredwa pamene kusintha kukuyamba, ndikuchotsedwa ikathaMaphunzirowa amapezeka mu component-animations.less
.
Ingowonjezerani data-toggle="collapse"
ndi a data-target
ku chinthucho kuti mugawiretu chiwongolero cha chinthu chomwe chimatha kutha. Malingaliro data-target
amavomereza chosankha cha CSS kuti agwiritse ntchito kugwa. Onetsetsani kuti mwawonjezera kalasi collapse
ku chinthu chomwe chimatha. Ngati mukufuna kuti isatseguke, onjezani kalasi yowonjezera in
.
Kuti muwonjeze kasamalidwe kagulu ka accordion ku chiwongolero chosokonekera, onjezani mawonekedwe a data data-parent="#selector"
. Onani pachiwonetsero kuti muwone izi zikugwira ntchito.
Yambitsani pamanja ndi:
Zosankha zitha kuperekedwa kudzera pa data kapena JavaScript. Pamawonekedwe a data, yonjezerani dzina lachisankho ku data-
, monga mu data-parent=""
.
Dzina | mtundu | kusakhulupirika | kufotokoza |
---|---|---|---|
kholo | wosankha | zabodza | Ngati chosankha chaperekedwa, ndiye kuti zinthu zonse zomwe zimatha kupindika pansi pa kholo lotchulidwa zidzatsekedwa chinthu chosokonekerachi chiwonetsedwa. (zofanana ndi chikhalidwe cha accordion - izi zimadalira panel kalasi) |
kusintha | boolean | zoona | Imasintha chinthu chomwe chimasokonekera pakuyitanitsa |
.collapse(options)
Imatsegula zomwe zili patsamba lanu ngati chinthu chosokonekera. Imavomereza zomwe mungachite object
.
.collapse('toggle')
Imasintha zinthu zomwe zimagundika kuti ziwonetsedwe kapena zobisika. Imabwereranso kwa woyimbayo chinthu chomwe chingathe kutha sichinasonyezedwe kapena kubisika (ie chisanachitike shown.bs.collapse
kapena hidden.bs.collapse
chochitikacho).
.collapse('show')
Imawonetsa chinthu chomwe chimatha kutha. Imabwereranso kwa woyimbayo chinthu chomwe chingathe kugwetsedwa chisanasonyezedwe (mwachitsanzo, shown.bs.collapse
chochitikacho chisanachitike).
.collapse('hide')
Imabisa chinthu chomwe chimatha kutha. Imabwereranso kwa woyimbirayo chinthu chosokonekera chisanabisike (mwachitsanzo, hidden.bs.collapse
chochitikacho chisanachitike).
Gulu la kugwa la Bootstrap limawulula zochitika zingapo kuti zigwirizane ndi kugwa.
Mtundu wa Chochitika | Kufotokozera |
---|---|
onetsani.bs.kugwa | Chochitika ichi chimayaka nthawi yomweyo show njira yachitsanzo itayitanidwa. |
zowonetsedwa.bs.kugwa | Chochitikachi chimachotsedwa pomwe chinthu chakugwa chawonetsedwa kwa wogwiritsa ntchito (chidikirira kuti kusintha kwa CSS kumalize). |
kubisa.bs.gwa | Chochitikachi chimathamangitsidwa nthawi yomweyo hide njirayo itayitanidwa. |
zobisika.bs.kugwa | Chochitikachi chimachotsedwa pomwe chinthu chakugwa chabisidwa kwa wogwiritsa ntchito (chidikirira kuti kusintha kwa CSS kumalize). |
Chigawo cha slideshow cha kupalasa njinga kudzera muzinthu, ngati carousel. Ma carousel okhala ndi zisa sagwiritsidwa ntchito.
Chigawo cha carousel nthawi zambiri sichigwirizana ndi miyezo yofikira. Ngati mukuyenera kutsatira, chonde ganizirani njira zina zowonetsera zomwe mwalemba.
Bootstrap imagwiritsa ntchito CSS3 pazojambula zake zokha, koma Internet Explorer 8 & 9 sichigwirizana ndi zofunikira za CSS. Choncho, palibe slide kusintha makanema ojambula pamanja ntchito asakatuli. Taganiza dala kuti tisaphatikizepo zolakwika za jQuery pakusintha.
Kalasi .active
iyenera kuwonjezeredwa ku imodzi mwazithunzi. Apo ayi, carousel sichidzawoneka.
The .glyphicon .glyphicon-chevron-left
ndi .glyphicon .glyphicon-chevron-right
makalasi si zofunika kwa zowongolera. Bootstrap imapereka .icon-prev
komanso .icon-next
ngati njira zina za unicode.
Onjezani mawu omasulira pamasiladi anu mosavuta ndi .carousel-caption
chinthu chomwe chili mkati mwa .item
. Ikani pafupifupi HTML iliyonse yomwe mwasankha mkati momwemo ndipo idzayanjanitsidwa ndi kusinthidwa.
Ma carousel amafuna kugwiritsa ntchito id
chotengera chakunja (the .carousel
) kuti zowongolera za carousel zizigwira bwino ntchito. Mukamawonjezera ma carousel angapo, kapena posintha ma carousel id
, onetsetsani kuti mwasintha zowongolera zoyenera.
Gwiritsani ntchito mawonekedwe a data kuti muwongolere malo a carousel mosavuta. data-slide
imavomereza mawu osakira prev
kapena next
, omwe amasintha malo a slide mogwirizana ndi momwe alili pano. Kapenanso, gwiritsani ntchito data-slide-to
kupititsa index ya silayidi ku carousel data-slide-to="2"
, yomwe imasamutsa malo a slide kupita ku index inayake kuyambira ndi 0
.
Makhalidwewa data-ride="carousel"
amagwiritsidwa ntchito kuyika carousel ngati yosangalatsa kuyambira pamasamba. Sichingagwiritsidwe ntchito limodzi ndi (zosafunikira komanso zosafunikira) kutsegulira kwa JavaScript kwa carousel yomweyo.
Imbani carousel pamanja ndi:
Zosankha zitha kuperekedwa kudzera pa data kapena JavaScript. Pamawonekedwe a data, yonjezerani dzina lachisankho ku data-
, monga mu data-interval=""
.
Dzina | mtundu | kusakhulupirika | kufotokoza |
---|---|---|---|
nthawi | nambala | 5000 | Kuchuluka kwa nthawi yochedwetsa pakati pa kuyendetsa chinthu chokha. Ngati zabodza, carousel siizungulira yokha. |
kupuma | chingwe | null | "kuyenda" | Ngati "hover" ikonzedwa , imitsani kukwera njinga ya carousel mouseenter ndikuyambanso kukwera njinga ya carousel pa mouseleave . Ngati null itayikidwa , kuyimirira pamwamba pa carousel sikuyimitsa. |
kulunga | boolean | zoona | Kaya carousel iyenera kuzungulira mosalekeza kapena kuyima movutikira. |
kiyibodi | boolean | zoona | Kaya carousel ikuyenera kuchitapo kanthu pazochitika za kiyibodi. |
.carousel(options)
Imayambitsa carousel ndi zosankha zomwe mungasankhe object
ndikuyamba kuyendetsa zinthu.
.carousel('cycle')
Amazungulira zinthu za carousel kuchokera kumanzere kupita kumanja.
.carousel('pause')
Imayimitsa carousel kuti isayendetse zinthu.
.carousel(number)
Azunguliza carousel ku chimango china (0 kutengera, ofanana ndi gulu).
.carousel('prev')
Kuzungulira kwa chinthu cham'mbuyo.
.carousel('next')
Kuzungulira ku chinthu chotsatira.
Kalasi ya carousel ya Bootstrap imawulula zochitika ziwiri zolumikizana ndi machitidwe a carousel.
Zochitika zonsezi zili ndi zotsatirazi zowonjezera:
direction
: Njira yomwe carousel ikutsetserekera (kaya "left"
kapena "right"
).relatedTarget
: Chigawo cha DOM chomwe chikusunthidwa kuti chikhale chogwira ntchito.Zochitika zonse za carousel zimathamangitsidwa pa carousel yomwe (ie pa <div class="carousel">
).
Mtundu wa Chochitika | Kufotokozera |
---|---|
slide.bs.carousel | Chochitika ichi chimayaka nthawi yomweyo slide njira yachitsanzo ikugwiritsidwa ntchito. |
slid.bs.carousel | Chochitikachi chimachotsedwa pamene carousel yamaliza kusintha kwake. |
Pulagi ya affix imasintha position: fixed;
ndi kuzimitsa, kutengera zomwe zapezeka ndi position: sticky;
. The subnavigation kumanja ndi moyo chiwonetsero cha affix plugin.
Gwiritsani ntchito pulogalamu yowonjezera pogwiritsa ntchito mawonekedwe a data kapena pamanja ndi JavaScript yanu. Muzochitika zonsezi, muyenera kupereka CSS pamayimidwe ndi m'lifupi mwazolemba zanu.
Zindikirani: Osagwiritsa ntchito pulogalamu yowonjezera pa chinthu chomwe chili m'malo okhazikika, monga mzati wokokedwa kapena kukankhidwa, chifukwa cha vuto la Safari .
Pulogalamu yowonjezera imasinthasintha pakati pa makalasi atatu, iliyonse ikuyimira dziko linalake: .affix
, .affix-top
, ndi .affix-bottom
. Muyenera kupereka masitayelo, kupatula position: fixed;
pa .affix
, pamakalasi awa nokha (osadalira pulogalamu yowonjezera iyi) kuti muthane ndi malo enieni.
Umu ndi momwe plugin ya affix imagwirira ntchito:
.affix-top
kusonyeza kuti chinthucho chili pamwamba kwambiri. Pakadali pano palibe malo a CSS omwe amafunikira..affix
m'malo .affix-top
ndi seti position: fixed;
(zoperekedwa ndi Bootstrap's CSS)..affix
ndi .affix-bottom
. Popeza zochotsera ndizosankha, kukhazikitsa imodzi kumafuna kuti muyike CSS yoyenera. Pankhaniyi, onjezani position: absolute;
ngati kuli kofunikira. Pulagiyi imagwiritsa ntchito mawonekedwe a data kapena njira ya JavaScript kuti idziwe komwe mungayike chinthucho kuchokera pamenepo.Tsatirani njira zomwe zili pamwambazi kuti mukhazikitse CSS yanu pazosankha zilizonse zomwe zili pansipa.
Kuti muwonjezeke mosavuta kuzinthu zilizonse, ingowonjezeranidata-spy="affix"
ku chinthu chomwe mukufuna kuti muzichiyang'ana. Gwiritsani ntchito ma offsets kutanthauzira nthawi yosinthira kusindikiza kwa chinthu.
Imbani pulogalamu yowonjezera kudzera pa JavaScript:
Zosankha zitha kuperekedwa kudzera pa data kapena JavaScript. Pamawonekedwe a data, yonjezerani dzina lachisankho ku data-
, monga mu data-offset-top="200"
.
Dzina | mtundu | kusakhulupirika | kufotokoza |
---|---|---|---|
kuchepetsa | nambala | ntchito | chinthu | 10 | Ma pixel oti muchotse pa skrini powerengera malo osindikizira. Ngati nambala imodzi yaperekedwa, chotsitsacho chidzagwiritsidwa ntchito pamwamba ndi pansi. Kuti mupereke chosinthira chapadera, chapansi ndi chapamwamba perekani chinthu offset: { top: 10 } kapena offset: { top: 10, bottom: 5 } . Gwiritsani ntchito pamene mukufunikira kuwerengera mosinthasintha. |
chandamale | kusankha | node | jQuery chinthu | window chinthu _ |
Imatchula chinthu chomwe mukufuna kuyikapo. |
.affix(options)
Imatsegula zomwe zili patsamba lanu ngati zophatikizika. Imavomereza zomwe mungachite object
.
.affix('checkPosition')
Imawerengetseranso malo a affix kutengera miyeso, malo, ndi malo a mpukutu wa zinthu zoyenera. The .affix
, .affix-top
, and .affix-bottom
makalasi amawonjezedwa kapena kuchotsedwa pazomwe zayikidwa molingana ndi dziko latsopano. Njirayi iyenera kutchedwa nthawi iliyonse miyeso ya zomwe zayikidwa kapena zomwe mukufuna zisinthidwa, kuti zitsimikizire kuti zomwe zaikidwazo zili bwino.
Pulogalamu yowonjezera ya Bootstrap imawulula zochitika zingapo kuti zigwirizane ndi magwiridwe antchito.
Mtundu wa Chochitika | Kufotokozera |
---|---|
phatikiza.bs.ikani | Chochitikachi chimayaka nthawi yomweyo chinthucho chisanamenyedwe. |
phatikiza.bs.ikani | Chochitikachi chimachotsedwa pambuyo poti chigawocho chayikidwa. |
affix-top.bs.affix | Chochitikachi chimayaka nthawi yomweyo chinthucho chisanakhazikitsidwe pamwamba. |
phatikiza-top.bs.affix | Chochitikachi chimachotsedwa chinthucho chikayikidwa pamwamba. |
phatikiza-pansi.bs.ikani | Chochitikachi chimayaka nthawi yomweyo chinthucho chisanakhazikike pansi. |
choyika-pansi.bs.affix | Chochitikachi chimachotsedwa pambuyo poti chinthucho chidayikidwa pansi. |