JavaScript
Hunza zvinhu zveBootstrap kuhupenyu neanopfuura gumi nemaviri tsika jQuery plugins. Nyoresa zvese zviri nyore, kana mumwe nemumwe.
Hunza zvinhu zveBootstrap kuhupenyu neanopfuura gumi nemaviri tsika jQuery plugins. Nyoresa zvese zviri nyore, kana mumwe nemumwe.
Plugins inogona kuverengerwa yega (uchishandisa Bootstrap's ega *.js
mafaera), kana ese kamwechete (uchishandisa bootstrap.js
kana minified bootstrap.min.js
).
Ose ari maviri bootstrap.js
uye bootstrap.min.js
ane ese plugins mune imwe faira. Batanidza imwe chete.
Mamwe mapulagi neCSS zvinotsamira pane mamwe mapulagi. Kana iwe ukasanganisira plugins wega, ita shuwa yekutarisa kune izvi zvinotsamira mumagwaro. Ziva zvakare kuti ese maplugins anoenderana nejQuery (izvi zvinoreva kuti jQuery inofanira kuverengerwa pamberi pemafaira eplugin). Bvunza yedubower.json
kuti uone kuti ndedzipi shanduro dzejQuery dzinotsigirwa.
Unogona kushandisa ese Bootstrap plugins chete kuburikidza neiyo markup API pasina kunyora mutsara mumwechete weJavaScript. Iyi ndiyo yekutanga-kirasi API yeBootstrap uye inofanirwa kuve yako yekutanga kufunga kana uchishandisa plugin.
Izvozvo zvakati, mune mamwe mamiriro ezvinhu zvingave zvinodiwa kudzima basa iri. Naizvozvo, isu tinopawo kugona kudzima iyo data attribute API nekusunungura zvese zviitiko pagwaro rakaiswa mazita ne data-api
. Izvi zvinotaridzika seizvi:
Neimwe nzira, kunanga imwe plugin, ingo sanganisira zita replugin sezita rezita pamwe chete nedata-api namespace seizvi:
Usashandise data hunhu kubva kune akawanda plugins pane imwechete chinhu. Semuenzaniso, bhatani harigone kuva neturusi uye kushandura modal. Kuti uite izvi, shandisa chinhu chekuputira.
Isu tinotenda zvakare kuti unofanirwa kukwanisa kushandisa ese Bootstrap plugins kuburikidza neJavaScript API. MaAPI ese eruzhinji inzira imwechete, inobatika, uye inodzosa kuunganidzwa kwaitwa.
Nzira dzese dzinofanirwa kugamuchira chinhu chekusarudza sarudzo, tambo inonangana neimwe nzira, kana hapana (iyo inotanga plugin ine default maitiro):
Imwe neimwe plugin zvakare inofumura mugadziri wayo mbishi pachivakwa Constructor
: $.fn.popover.Constructor
. Kana iwe uchida kuwana imwe plugin muenzaniso, itore zvakananga kubva kune chinhu: $('[rel="popover"]').data('popover')
.
Unogona kushandura zvigadziriso zveplugin nekugadzirisa chinhu cheplugin Constructor.DEFAULTS
:
Dzimwe nguva zvinodikanwa kushandisa Bootstrap plugins nemamwe maUI maficha. Mumamiriro ezvinhu aya, kudhumhana kwemazita kunogona kuitika dzimwe nguva. Kana izvi zvikaitika, unogona kufonera .noConflict
plugin yaunoda kudzorera kukosha kwayo.
Bootstrap inopa zviitiko zvetsika kune akawanda plugins 'akasarudzika zviito. Kazhinji, izvi zvinouya muchimiro chechirevo chisingaperi uye chekare - apo chisingaperi (ex. show
) chinotangwa pakutanga kwechiitiko, uye chimiro chayo chechirevo chekare (ex. shown
) chinotangwa pakupedzwa kwechiito.
Kubva pa3.0.0, zviitiko zvese zveBootstrap zvine mazita.
Zvose zvisingagumi zviitiko zvinopa preventDefault
kushanda. Izvi zvinopa kugona kumisa kuitwa kwechiito chisati chatanga.
Zvishandiso uye Popovers anoshandisa yedu yakavakirwa-mukati sanitizer kuchenesa sarudzo dzinogamuchira HTML.
The default whiteList
value ndeiyi inotevera:
Kana iwe uchida kuwedzera hutsva hutsva kune iyi default whiteList
unogona kuita zvinotevera:
Kana iwe uchida kupfuura yedu sanitizer nekuti unofarira kushandisa raibhurari yakatsaurirwa, semuenzaniso DOMpurify , unofanirwa kuita zvinotevera:
document.implementation.createHTMLDocument
Kana mabhurawuza asingatsigire document.implementation.createHTMLDocument
, seInternet Explorer 8, iyo yakavakirwa-mukati sanitize basa inodzosa iyo HTML sezvairi.
Kana iwe uchida kuita sanitization mune iyi kesi, ndapota tsanangura sanitizeFn
uye shandisa raibhurari yekunze senge DOMpurify .
Iyo vhezheni yeimwe neimwe yeBootstrap's jQuery plugins inogona kuwanikwa kuburikidza nemudziyo wemugadziri weplugin VERSION
. Semuenzaniso, kune tooltip plugin:
Bootstrap's plugins haidzoke kumashure zvakanyanya nenyasha kana JavaScript yakadzimwa. Kana iwe uine hanya neruzivo rwemushandisi mune iyi kesi, shandisa <noscript>
kutsanangura mamiriro acho (uye maitiro ekuitazve JavaScript) kune vashandisi vako, uye/kana wedzera yako wega yekudonha.
Bootstrap haitsigire zviri pamutemo-wechitatu-bato JavaScript raibhurari sePrototype kana jQuery UI. Kunyangwe .noConflict
uye zviitiko zvakapatsanurwa mazita, panogona kunge paine matambudziko ekuenderana aunoda kugadzirisa wega.
Kuti uite shanduko yakapusa, sanganisira transition.js
kamwe chete padivi pemamwe mafaera eJS. Kana uri kushandisa compiled (kana minified) bootstrap.js
, hapana chikonzero chekuisa izvi-zvatovepo.
Transition.js mubatsiri wekutanga transitionEnd
wezviitiko pamwe neCSS transition emulator. Inoshandiswa nemamwe maplugins kutarisa CSS shanduko yerutsigiro uye kubata yakarembera shanduko.
Shanduko dzinogona kuvharwa pasi rose uchishandisa inotevera JavaScript snippet, iyo inofanirwa kuuya mushure transition.js
(kana bootstrap.js
, bootstrap.min.js
sezvazvingave) yatakura:
Modals inogadziridzwa, asi inoshanduka, dialog inokurudzira ine hushoma hunodiwa mashandiro uye smart defaults.
Iva nechokwadi chekusavhura modal apo imwe ichiri kuoneka. Kuratidza modal inodarika imwe panguva inoda kodhi yakasarudzika.
Gara uchiyedza kuisa modal's HTML kodhi munzvimbo yepamusoro-yepamusoro mugwaro rako kudzivirira zvimwe zvikamu zvinokanganisa kutaridzika kwe modal uye/kana kushanda.
Kune mamwe macaveats maererano nekushandisa modal pane nharembozha. Ona yedu bhurawuza rutsigiro docs kuti uwane ruzivo.
Nekuda kwekuti HTML5 inotsanangura sei semantics yayo, iyo autofocus
HTML hunhu haina mhedzisiro muBootstrap modal. Kuti uwane maitiro akafanana, shandisa imwe tsika JavaScript:
A revered modal ine musoro, muviri, uye seti yezviito munyasi.
Shandura modal kuburikidza neJavaScript nekudzvanya bhatani riri pazasi. Ichatsvedza pasi uye kupera mukati kubva kumusoro kwepeji.
Iva nechokwadi chekuwedzera role="dialog"
uye aria-labelledby="..."
, uchinongedzera zita re modal, ku .modal
, uye role="document"
kune .modal-dialog
pacharo.
Pamusoro pezvo, iwe unogona kupa tsananguro yemodal dialog yako ne aria-describedby
pa .modal
.
Kuisa mavhidhiyo eYouTube mumodals kunoda yekuwedzera JavaScript isiri muBootstrap kuti imise otomatiki kutamba nezvimwe. Ona iyi inobatsira Stack Overflow post kuti uwane rumwe ruzivo.
Modals dzine saizi mbiri dzekusarudzika, dzinowanikwa kuburikidza nemodhifita makirasi kuti aiswe pane .modal-dialog
.
Kune ma modal anongooneka pane kudzima kuti aone, bvisa .fade
kirasi kubva pane yako modal markup.
Kutora mukana weBootstrap grid system mukati me modal, ingori nest .row
s mukati .modal-body
uye wobva washandisa yakajairika grid system makirasi.
Iva neboka remabhatani anokonzeresa modal imwe chete, nezviri mukati zvakasiyana zvishoma? Shandisa event.relatedTarget
uye HTML data-*
hunhu (pamwe kuburikidza nejQuery ) kusiyanisa zviri mukati me modal zvichienderana nekuti bhatani ripi rakadzvanywa. Ona iyo Modal Zviitiko zvinyorwa zveruzivo pa relatedTarget
,
Iyo modal plugin inoshandura yako yakavanzika yemukati paunoda, kuburikidza nedata hunhu kana JavaScript. Iyo inowedzerawo .modal-open
kune <body>
yekupfuura default kupuruzira maitiro uye inogadzira .modal-backdrop
yekupa yekudzvanya nzvimbo yekudzinga yakaratidzwa modal kana uchidzvanya kunze kwe modal.
Shandisa modal pasina kunyora JavaScript. Gadzirisa data-toggle="modal"
chinhu chekutonga, sebhatani, pamwe chete nea data-target="#foo"
kana href="#foo"
kunanga imwe modhi yekushandura.
Fonera modal ine id myModal
ine mutsara mumwechete weJavaScript:
Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-
, semu data-backdrop=""
.
Zita | type | default | tsananguro |
---|---|---|---|
kumashure | boolean kana tambo'static' |
chokwadi | Inosanganisira modal-backdrop element. Neimwe nzira, tsanangura static kune yekumashure iyo isingavhare modal pakudzvanya. |
keyboard | boolean | chokwadi | Inovhara modal kana kiyi yekutiza ikadzvanywa |
show | boolean | chokwadi | Inoratidza modal kana yatangwa. |
kure | nzira | nhema | Iyi sarudzo yakabviswa kubva v3.3.0 uye yakabviswa muv4. Isu tinokurudzira pachinzvimbo chekushandisa client-side templating kana data binding framework, kana kufonera jQuery.load iwe pachako. Kana URL iri kure ichipihwa, zvirimo zvinotakurwa kamwe chete kuburikidza nejQuery's |
.modal(options)
Inomisa zvirimo zvako se modal. Inobvuma sarudzo dzaungada object
.
.modal('toggle')
Pamaoko anoshandura modal. Inodzokera kune akafona modal isati yanyatsoratidzwa kana kuvanzwa (kureva kuti shown.bs.modal
kana hidden.bs.modal
chiitiko chisati chaitika).
.modal('show')
Nemaoko anovhura modal. Inodzokera kune akafona modal isati yanyatsoratidzwa (kureva kuti shown.bs.modal
chiitiko chisati chaitika).
.modal('hide')
Anozvivanza modal. Inodzokera kune akafona modal isati yanyatsovanzwa (kureva kuti hidden.bs.modal
chiitiko chisati chaitika).
.modal('handleUpdate')
Inogadzirisa nzvimbo ye modal kupikisa scrollbar kana imwe ikaonekwa, izvo zvinoita kuti modal isvetuke kuruboshwe.
Inongodiwa chete kana kureba kwe modal kuchichinja payakavhurika.
Bootstrap's modal kirasi inofumura zviitiko zvishoma zvekukochekera kuita modal mashandiro.
Zvese zviitiko zve modal zvinodzingwa pa modal pachayo (kureva pa <div class="modal">
).
Chiitiko Type | Tsanangudzo |
---|---|
show.bs.modal | Ichi chiitiko chinopisa nekukasira kana show nzira yemuenzaniso inodanwa. Kana ikakonzerwa nekudzvanya, chinhu chakadzvanywa chinowanikwa sechinhu relatedTarget chechiitiko. |
kuratidza.bs.modal | Ichi chiitiko chinodzingwa kana modal yaitwa kuti ionekwe kumushandisi (inomirira kuti CSS shanduko ipedze). Kana ikakonzerwa nekudzvanya, chinhu chakadzvanywa chinowanikwa sechinhu relatedTarget chechiitiko. |
hide.bs.modal | Ichi chiitiko chinodzingwa nekukasira kana iyo hide muenzaniso nzira yadaidzwa. |
zvakavanzika.bs.modal | Ichi chiitiko chinodzingwa kana modal yapedza kuvanzwa kubva kumushandisi (inomirira kuti CSS shanduko ipedze). |
loaded.bs.modal | Ichi chiitiko chinodzingwa kana modal yakatakura zvemukati uchishandisa remote sarudzo. |
Wedzera mamenu ekudonha kune chero chinhu neiyi plugin iri nyore, kusanganisira iyo navbar, ma tabo, uye mapiritsi.
Kuburikidza nehunhu hwedhata kana JavaScript, iyo yekudonha plugin inoshandura zvakavanzika zvemukati (mamenu ekudonha) nekushandura .open
kirasi pane yevabereki rondedzero chinhu.
Pane nharembozha, kuvhura kudonhedza kunowedzera .dropdown-backdrop
senzvimbo yepombi yekuvhara mamenu ekudonha kana uchibaya kunze kwemenyu, chinodiwa cherutsigiro chakakodzera cheIOS. Izvi zvinoreva kuti kuchinja kubva pane yakavhurika yekudonhedza menyu kuenda kune yakasiyana yekudonha menyu kunoda imwe tepi panharembozha.
Ongorora: data-toggle="dropdown"
Humwe hunhu hunovimbwa nahwo pakuvhara mamenu ekudonha padanho rekushandisa, saka ipfungwa yakanaka kugara uchiishandisa.
Wedzera data-toggle="dropdown"
kune chinongedzo kana bhatani kuti uchinje kudonhedza.
Kuti uchengetedze maURL akazara nemabhatani ekubatanidza, shandisa data-target
hunhu pachinzvimbo che href="#"
.
Fonera zvinodonha kuburikidza neJavaScript:
data-toggle="dropdown"
zvichiri kudiwaKunyangwe iwe uchifonera kudonha kwako kuburikidza neJavaScript kana kuti panzvimbo pacho shandisa iyo data-api, data-toggle="dropdown"
inogara ichidikanwa kuti unge uripo pane inodonhedza inokonzeresa chinhu.
Hapana
$().dropdown('toggle')
Shandura menyu yekudonhedza yakapihwa navbar kana tabbed navigation.
Zvese zviitiko zvekudonhedza zvinodzingwa kune .dropdown-menu
's mubereki element.
Zviitiko zvese zvekudonhedza zvine relatedTarget
pfuma, iyo kukosha kwayo ndeye toggling anchor element.
Chiitiko Type | Tsanangudzo |
---|---|
show.bs.dropdown | Ichi chiitiko chinopisa nekukasira kana iyo nzira yemuenzaniso inodanwa. |
display.bs.kudonha | Ichi chiitiko chinodzingwa kana kudonhedza kwaitwa kuti kuonekwe kumushandisi (ichamirira shanduko yeCSS, kuti ipedze). |
hide.bs.dropdown | Chiitiko ichi chinodzingwa nekukasira kana nzira yekuhwanda yadaidzwa. |
hidden.bs.dropdown | Chiitiko ichi chinodzingwa kana kudonhedza kwapera kuvanzwa kubva kumushandisi (ichamirira shanduko yeCSS, kuti ipedze). |
Iyo ScrollSpy plugin ndeyekugadzirisa otomatiki zvinangwa zve nav zvichienderana nenzvimbo yekupumburudza. Skrodza nzvimbo iri pazasi pebhari uye tarisa iyo inoshanda kirasi shanduko. Izvo zvinodonhedza sub zvinhu zvicharatidzwa zvakare.
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi vasati vatengesa izvo. Tumblr purazi-ku-tafura kodzero dzebhasikoro chero. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui pamwe hausati wanzwa nezvavo et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork ndebvu. Freegan ndebvu aliqua cupidatat mcsweeney's vero. Cupidatat mana ako ini, ea helvetica nulla carles. Tattooed cosby sweater chikafu rori, 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 doro deserunt skateboard ea. Lomo bhasikoro kodzero adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. Hupenyu hwepamusoro id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, inogara yakasimba 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 chero deelectus chikafu rori. Sapiente synth id imaginenda. Locavore sed helvetica cliche irony, mabhanan'ana iwe pamwe hausati wanzwa nezvawo consequat hoodie gluten-isina lo-fi fap aliquip. Labore elit placeat vasati vatengesa, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.
Navbar links dzinofanirwa kunge dziine zvinogadziriswa id zvinangwa. Semuenzaniso, <a href="#home">home</a>
inofanirwa kuenderana nechimwe chinhu chiri muDOM senge <div id="home"></div>
.
:visible
zvakafuratirwaZvinangwa zvinhu zvisingaenderane :visible
nejQuery zvicharegeredzwa uye izvo zvinoenderana nav zvinhu hazvizombofa zvakasimbiswa.
Hazvina mhosva kuti nzira yekushandisa sei, scrollspy inoda kushandiswa position: relative;
kwechinhu chauri kuongorora. Kazhinji iyi ndiyo <body>
. Paunenge uchipuruzira pane zvimwe zvinhu zvisiri izvo <body>
, ita shuwa kuti une height
seti uye overflow-y: scroll;
yaiswa.
Kuti uwedzere nyore scrollspy maitiro kune yako topbar navigation, wedzera data-spy="scroll"
kune chinhu chaunoda kunosora (kazhinji ichi chingave icho <body>
). Wobva wawedzera data-target
hunhu neID kana kirasi yemubereki chinhu cheBootstrap .nav
chikamu.
Mushure mekuwedzera position: relative;
muCSS yako, fonera iyo scrollspy kuburikidza neJavaScript:
.scrollspy('refresh')
Paunenge uchishandisa scrollspy pamwe nekuwedzera kana kubvisa zvinhu kubva kuDOM, iwe unozofanirwa kufonera nzira yekuzorodza senge:
Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-
, semu data-offset=""
.
Zita | type | default | tsananguro |
---|---|---|---|
offset | nhamba | 10 | Mapikisi ekubvisa kubva kumusoro paunenge uchiverenga nzvimbo yekupumburudza. |
Chiitiko Type | Tsanangudzo |
---|---|
activate.bs.scrollspy | Chiitiko ichi chinopisa chero chinhu chitsva chikavhurwa neiyo scrollspy. |
Wedzera nekukurumidza, kusimba kwetabhu mashandiro ekuchinja kuburikidza nemapaneru ezvemukati zvemukati, kunyangwe kuburikidza nekudonhedza menyu. Nested tabs haatsigirwe.
Raw denim pamwe hausati wanzwa nezvavo zvipfupi zvejean 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 apparel, 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.
Iyi plugin inowedzera iyo tabbed navigation chikamu kuti uwedzere tabable nzvimbo.
Gonesa tabable tabs kuburikidza neJavaScript (tebhu yega yega inoda kuvhurwa yega):
Iwe unogona kumisa ma tabo ega ega munzira dzinoverengeka:
Unogona kumisikidza tebhu kana piritsi kufamba usinganyore chero JavaScript nekungotsanangura data-toggle="tab"
kana data-toggle="pill"
pane chinhu. Kuwedzera iyo nav
uye nav-tabs
makirasi kune iyo tebhu kuchaisa ul
iyo Bootstrap tebhu styling , uchiwedzera iyo nav
uye nav-pills
makirasi anozoshandisa mapiritsi styling .
Kuita kuti ma tabo asvike mukati, wedzera .fade
kune imwe neimwe .tab-pane
. Yekutanga tab pane inofanirwawo .in
kuita kuti zvekutanga zvionekwe.
$().tab
Inomisikidza chinhu chetabhu uye mudziyo wemukati. Tab inofanirwa kunge iine data-target
kana href
yakanangana nemudziyo node muDOM. Mumienzaniso iri pamusoro, ma tabs ndiwo <a>
s ane data-toggle="tab"
hunhu.
.tab('show')
Inosarudza tabhu yakapihwa uye inoratidza zvayakabatana nazvo. Chero imwe tab yakambosarudzwa inove isina kusarudzwa uye zvine chekuita nazvo zvakavanzwa. Inodzokera kumunhu arikufona tebhu isati yanyatsoratidzwa (kureva kuti shown.bs.tab
chiitiko chisati chaitika).
Kana uchiratidza tebhu nyowani, zviitiko zvinopisa nenzira inotevera:
hide.bs.tab
(pane ikozvino inoshanda tab)show.bs.tab
(paicha-kuratidzwa tab)hidden.bs.tab
(paiyo yapfuura inoshanda tebhu, yakafanana hide.bs.tab
neyechiitiko)shown.bs.tab
(paiyo ichangobva-kushanda ichangoratidzwa tab, yakafanana show.bs.tab
neyechiitiko)Kana pasina tebhu yanga yatoshanda, saka iyo hide.bs.tab
uye hidden.bs.tab
zviitiko hazvizodzingwa.
Chiitiko Type | Tsanangudzo |
---|---|
show.bs.tab | Ichi chiitiko chinopisa pane tab show, asi iyo itsva tebhu isati yaratidzwa. Shandisa event.target uye event.relatedTarget kunanga iyo inoshanda tebhu uye yapfuura inoshanda tebhu (kana iripo) zvichiteerana. |
display.bs.tab | Ichi chiitiko chinopisa pane tab show mushure mekunge tab yaratidzwa. Shandisa event.target uye event.relatedTarget kunanga iyo inoshanda tebhu uye yapfuura inoshanda tebhu (kana iripo) zvichiteerana. |
hide.bs.tab | Ichi chiitiko chinopisa kana tabhu nyowani icharatidzwa (uye nekudaro iyo yapfuura inoshanda tebhu inofanira kuvanzwa). Shandisa event.target uye event.relatedTarget kunanga yazvino inoshanda tebhu uye iyo nyowani-ichaita-inoshanda tebhu, zvichiteerana. |
zvakavanzika.bs.tab | Ichi chiitiko chinopisa mushure mekunge tabhu nyowani yaratidzwa (uye nekudaro iyo yapfuura inoshanda tebhu yakavanzwa). Shandisa event.target uye event.relatedTarget kunanga iyo yapfuura inoshanda tebhu uye iyo itsva inoshanda tebhu, zvichiteerana. |
Yakafuridzirwa neyakanakisa jQuery.tipsy plugin yakanyorwa naJason Frame; Maturusi ivhezheni yakagadziridzwa, isingavimbi nemifananidzo, shandisa CSS3 yemifananidzo, uye data-maitiro ekuchengetera mazita enzvimbo.
Zvishandiso zvine mazita akareba zero hazvimbotaridzwa.
Hover pamusoro pemalink ari pasi apa kuti uone maturusi ekushandisa:
Tight bhurugwa next level keffiyeh pamwe hausati wanzwa nezvavo. Photo booth ndebvu mbishi denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american nguo ine terry richardson vinyl chambray. Ndebvu stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, mana loko mcsweeney's cleanse vegan chambray. A really artisan artisan whatever keytar , scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral.
Sarudzo ina dziripo: kumusoro, kurudyi, pasi, uye kuruboshwe zvakaenderana.
Nekuda kwezvikonzero zvekuita, iyo Tooltip nePopover data-apis inopinda, zvichireva kuti unofanira kuzvitangisa iwe pachako .
Imwe nzira yekutanga matipi ezvishandiso pane peji ndeyekuvasarudza nehunhu hwavo data-toggle
:
Iyo tooltip plugin inogadzira zvirimo uye markup pane inodiwa, uye neyakagadzika nzvimbo matipi eturusi mushure meiyo trigger element.
Tamba chishandiso kuburikidza neJavaScript:
Mucherechedzo unodiwa wetipi yeturusi ingori data
hunhu uye title
pane HTML chinhu chaunoshuvira kuve nechokushandisa. Iyo yakagadzirwa markup yeturusitip iri nyore, kunyangwe ichida chinzvimbo (nekumisikidza, yakarongedzwa top
neplugin).
Dzimwe nguva iwe unoda kuwedzera chishandiso kune hyperlink inoputira mitsetse yakawanda. Maitiro ekutanga eiyo tooltip plugin ndeyekuiisa pakati yakachinjika uye yakatwasuka. Wedzera white-space: nowrap;
kune zvibatiso zvako kudzivirira izvi.
Paunenge uchishandisa matipi ezvishandiso pazvinhu zviri mukati me a .btn-group
kana .input-group
, kana pane zvine chekuita netafura ( <td>
, <th>
, <tr>
, <thead>
, <tbody>
, <tfoot>
), uchafanirwa kudoma sarudzo container: 'body'
(yakanyorwa pazasi) kudzivirira zvisingadiwe mhedzisiro (senge chinhu chiri kukura zvakafara uye/ kana kurasikirwa nemakona ayo akatenderedzwa kana turusi rekushandisa rabatidzwa).
Kune vashandisi vanofamba nekhibhodi, uye kunyanya vashandisi veanobatsira matekinoroji, iwe unofanirwa chete kuwedzera matipi kune keyboard-inotariswa zvinhu senge zvinongedzo, mafomu ekudzora, kana chero chinhu chinopokana chine tabindex="0"
hunhu.
Kuwedzera chishandiso kune chimwe disabled
kana .disabled
chinhu, isa chinhu mukati me a <div>
uye woisa matipi kune icho <div>
panzvimbo.
Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-
, semu data-animation=""
.
Ziva kuti nekuda kwezvikonzero zvekuchengetedza iyo sanitize
, sanitizeFn
uye whiteList
sarudzo haigone kupihwa uchishandisa data hunhu.
Zita | Type | Default | Tsanangudzo |
---|---|---|---|
animation | boolean | chokwadi | Isa CSS fade shanduko kune tooltip |
mudziyo | tambo | nhema | nhema | Inoisa tip kune chimwe chinhu. Muenzaniso |
delay | nhamba | object | 0 | Kunonoka kuratidza uye kuvanza iyo tooltip (ms) - haishande kune manual trigger type Kana nhamba yapihwa, kunonoka kunoiswa kune ese ari maviri hide/show Chimiro chechinhu ndeichi: |
html | boolean | nhema | Isa HTML muchokushandisa. Kana nhema, nzira yejQuery text ichashandiswa kuisa zvirimo muDOM. Shandisa zvinyorwa kana uchinetseka nezve XSS kurwiswa. |
kuiswa | tambo | basa | 'pamusoro' | Maitiro ekuisa iyo tooltip - kumusoro | pasi | left | right | auto. Kana basa rikashandiswa kuona kuiswa, rinodanwa neturusipi DOM node senharo yayo yekutanga uye chinokonzeresa chinhu DOM node sechipiri. Mamiriro |
selector | tambo | nhema | Kana sarudzo yakapihwa, zviro zveturusi zvinopihwa kune izvo zvakatarwa. Mukuita, izvi zvinoshandiswa kushandisawo matipi ekushandisa kune zvine simba akawedzera DOM zvinhu ( jQuery.on rutsigiro). Ona izvi uye muenzaniso unodzidzisa . |
template | tambo | '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' |
Base HTML yekushandisa paunenge uchigadzira iyo tooltip. The tooltip's
Chinhu chekunze chekuputira chinofanira kunge chine |
title | tambo | basa | '' | Default title value kana Kana basa rapihwa, rinodaidzwa nereferensi yaro |
trigger | tambo | 'hover focus' | Maturusi ekushandisa anokonzereswa sei - tinya | hovha | focus | manual. Unogona kupfuura akawanda anokonzeresa; vaparadzanise nenzvimbo. manual haigone kusanganiswa nechero imwe trigger. |
viewport | tambo | chinhu | basa | {selector: 'body', padding: 0} | Inochengeta chishandiso mukati memiganhu yechinhu ichi. Muenzaniso: Kana basa rapihwa, rinodaidzwa nechinhu chinokonzeresa DOM node senharo yayo chete. Mamiriro |
sanitize | boolean | chokwadi | Gonesa kana kudzima sanitization. Kana ikashandiswa 'template' , 'content' uye 'title' sarudzo dzichacheneswa. |
whiteList | object | Default value | Chinhu chine hunhu uye ma tag anotenderwa |
sanitizeFn | null | basa | null | Pano iwe unogona kupa yako wega sanitize basa. Izvi zvinogona kubatsira kana ukada kushandisa raibhurari yakatsaurirwa kuita sanitization. |
Sarudzo dzematurusi ega ega dzinogona kutsanangurwa neimwe nzira kuburikidza nekushandisa data hunhu, sezvatsanangurwa pamusoro.
$().tooltip(options)
Inonamira chibatiso cheturusi kune muunganidzwa wezvinhu.
.tooltip('show')
Inoratidza chekushandisa chechinhu. Inodzokera kumunhu arikufona tip rekushandisa risati ranyatsoratidzwa (kureva kuti shown.bs.tooltip
chiitiko chisati chaitika). Izvi zvinoonekwa se "manual" inokonzeresa yeturusitip. Zvishandiso zvine mazita akareba zero hazvimbotaridzwa.
.tooltip('hide')
Inovanza zano rekushandisa. Inodzokera kune ari kufona chitupa chisati chavanzwa (kureva kuti hidden.bs.tooltip
chiitiko chisati chaitika). Izvi zvinoonekwa se "manual" inokonzeresa yeturusitip.
.tooltip('toggle')
Inoshandura matipi echinhu. Inodzokera kune ari kufona chitupa chisati charatidzwa kana kuvanzwa (kureva kuti shown.bs.tooltip
kana hidden.bs.tooltip
chiitiko chisati chaitika). Izvi zvinoonekwa se "manual" inokonzeresa yeturusitip.
.tooltip('destroy')
Inoviga nekuparadza mudziyo wekushandisa. Zvishandiso zvinoshandisa kugovera (zvinogadzirwa pachishandiswa sarudzoselector
) hazvingaparadzwi pachega pazvikamu zvinokonzeresa zvedzinza .
Chiitiko Type | Tsanangudzo |
---|---|
show.bs.tooltip | Ichi chiitiko chinopisa nekukasira kana show nzira yemuenzaniso inodanwa. |
display.bs.tooltip | Chiitiko ichi chinodzingwa kana chishandiso chaitwa kuti chionekwe kumushandisi (chinomirira kuti CSS shanduko ipedze). |
hide.bs.tooltip | Ichi chiitiko chinodzingwa nekukasira kana iyo hide muenzaniso nzira yadaidzwa. |
zvakavanzika.bs.tooltip | Chiitiko ichi chinodzingwa kana chishandiso chapedza kuvanzwa kubva kumushandisi (chinomirira kuti CSS shanduko ipere). |
inserted.bs.tooltip | Chiitiko ichi chinodzingwa mushure show.bs.tooltip mechiitiko apo template yekushandisa yawedzerwa kuDOM. |
Wedzera zvidiki zvakafukidzwa zvemukati, sezviya zviri paPadad, kune chero chinhu cheimba yechipiri ruzivo.
Mapopovers ane zvese zita uye zvirimo zviri zero-kureba hazvimbotaridzwa.
Popovers inoda iyo tooltip plugin kuti ibatanidzwe mune yako vhezheni yeBootstrap.
Nekuda kwezvikonzero zvekuita, iyo Tooltip nePopover data-apis inopinda, zvichireva kuti unofanira kuzvitangisa iwe pachako .
Imwe nzira yekutanga mapopovers pane peji ingave yekuvasarudza nehunhu hwavo data-toggle
:
Paunenge uchishandisa mapopovers pazvinhu zviri mukati me a .btn-group
kana .input-group
, kana pane zvine chekuita netafura ( <td>
, <th>
, <tr>
, <thead>
, <tbody>
, <tfoot>
), uchafanirwa kudoma sarudzo container: 'body'
(yakanyorwa pazasi) kudzivirira zvisingadiwe mhedzisiro (senge chinhu chiri kukura zvakafara uye/ kana kurasikirwa nemakona ayo akatenderedzwa kana popover inotangwa).
Kuti uwedzere popover kune imwe disabled
kana .disabled
chinhu, isa chinhu mukati me a <div>
uye isa popover kune icho <div>
panzvimbo.
Dzimwe nguva iwe unoda kuwedzera popover kune hyperlink inoputira mitsetse yakawanda. Maitiro ekutanga eiyo popover plugin ndeyekuisa pakati payo yakachinjika uye yakatwasuka. Wedzera white-space: nowrap;
kune zvibatiso zvako kudzivirira izvi.
Sarudzo ina dziripo: kumusoro, kurudyi, pasi, uye kuruboshwe zvakaenderana.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Shandisa focus
chinokonzeresa kudzinga mapopovers pakudzvanya kunotevera kunoitwa nemushandisi.
Kuti uwane chaiyo-muchinjika-browser uye muchinjika-chikuva maitiro, iwe unofanirwa kushandisa iyo <a>
tag, kwete iyo <button>
tag, uye iwe zvakare unofanirwa kusanganisira iyo role="button"
uye tabindex
hunhu.
Gonesa mapopovers kuburikidza neJavaScript:
Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-
, semu data-animation=""
.
Ziva kuti nekuda kwezvikonzero zvekuchengetedza iyo sanitize
, sanitizeFn
uye whiteList
sarudzo haigone kupihwa uchishandisa data hunhu.
Zita | Type | Default | Tsanangudzo |
---|---|---|---|
animation | boolean | chokwadi | Isa CSS fade shanduko kune popover |
mudziyo | tambo | nhema | nhema | Inoisa popover kune chimwe chinhu. Muenzaniso |
content | tambo | basa | '' | Default content value kana Kana basa rakapihwa, rinodaidzwa nereferensi yaro |
delay | nhamba | object | 0 | Kunonoka kuratidza uye kuvanza iyo popover (ms) - haishande kune manual trigger type Kana nhamba yapihwa, kunonoka kunoiswa kune ese ari maviri hide/show Chimiro chechinhu ndeichi: |
html | boolean | nhema | Isa HTML mune popover. Kana nhema, nzira yejQuery text ichashandiswa kuisa zvirimo muDOM. Shandisa zvinyorwa kana uchinetseka nezve XSS kurwiswa. |
kuiswa | tambo | basa | 'rudyi' | Maitiro ekuisa popover - kumusoro | pasi | left | right | auto. Kana basa rikashandiswa kuona kuiswa, rinodaidzwa nepopover DOM node senharo yayo yekutanga uye chinokonzeresa DOM node sechipiri. Mamiriro |
selector | tambo | nhema | Kana sarudzo yakapihwa, popover zvinhu zvinopihwa kune izvo zvakatarwa. Mukuita, izvi zvinoshandiswa kugonesa dynamic HTML zvemukati kuve nemapopovers akawedzerwa. Ona izvi uye muenzaniso unodzidzisa . |
template | tambo | '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' |
Base HTML yekushandisa paunenge uchigadzira popover. Iyo popover's Iyo popover's
Chinhu chekunze chekuputira chinofanira kunge chine |
title | tambo | basa | '' | Default title value kana Kana basa rakapihwa, rinodaidzwa nereferensi yaro |
trigger | tambo | 'tinya' | Iyo popover inokonzereswa sei - tinya | hovha | focus | manual. Unogona kupfuura akawanda anokonzeresa; vaparadzanise nenzvimbo. manual haigone kusanganiswa nechero imwe trigger. |
viewport | tambo | chinhu | basa | {selector: 'body', padding: 0} | Inochengeta popover mukati memiganhu yechinhu ichi. Muenzaniso: Kana basa rapihwa, rinodaidzwa nechinhu chinokonzeresa DOM node senharo yayo chete. Mamiriro |
sanitize | boolean | chokwadi | Gonesa kana kudzima sanitization. Kana ikashandiswa 'template' , 'content' uye 'title' sarudzo dzichacheneswa. |
whiteList | object | Default value | Chinhu chine hunhu uye ma tag anotenderwa |
sanitizeFn | null | basa | null | Pano iwe unogona kupa yako wega sanitize basa. Izvi zvinogona kubatsira kana ukada kushandisa raibhurari yakatsaurirwa kuita sanitization. |
Sarudzo dzemapopovers ega dzinogona kutsanangurwa neimwe nzira kuburikidza nekushandisa data hunhu, sezvatsanangurwa pamusoro.
$().popover(options)
Inotanga popover yekuunganidza zvinhu.
.popover('show')
Inoratidza kubuda kwechimwe chinhu. Inodzokera kumunhu arikufona popover isati yanyatsoratidzwa (kureva kuti shown.bs.popover
chiitiko chisati chaitika). Izvi zvinoonekwa se "manual" inokonzeresa yepopover. Mapopovers ane zvese zita uye zvirimo zviri zero-kureba hazvimbotaridzwa.
.popover('hide')
Inovanza kubuda kwechinhu. Inodzokera kune akafona popover isati yanyatsovanzwa (kurevahidden.bs.popover
chiitiko chisati chaitika). Izvi zvinoonekwa se "manual" inokonzeresa yepopover.
.popover('toggle')
Inoshandura kubuda kwechinhu. Inodzokera kumunhu arikufona popover isati yaratidzwa kana kuvanzwa (kureva kuti shown.bs.popover
kana hidden.bs.popover
chiitiko chisati chaitika). Izvi zvinoonekwa se "manual" inokonzeresa yepopover.
.popover('destroy')
Inoviga uye inoparadza popover yechinhu. Mapopover anoshandisa kugovera (ayo anogadzirwa pachishandiswa sarudzoselector
) haagone kuparadzwa ega pane zvinokonzeresa zvinhu .
Chiitiko Type | Tsanangudzo |
---|---|
show.bs.popover | Ichi chiitiko chinopisa nekukasira kana show nzira yemuenzaniso inodanwa. |
display.bs.popover | Ichi chiitiko chinodzingwa kana popover yaitwa kuti ionekwe kumushandisi (inomirira kuti CSS shanduko ipedze). |
hide.bs.popover | Ichi chiitiko chinodzingwa nekukasira kana iyo hide muenzaniso nzira yadaidzwa. |
zvakavanzika.bs.popover | Ichi chiitiko chinodzingwa kana popover yapedza kuvanzwa kubva kumushandisi (inomirira kuti CSS shanduko ipedze). |
inserted.bs.popover | Ichi chiitiko chinodzingwa mushure show.bs.popover mechiitiko apo popover template yawedzerwa kuDOM. |
Wedzera mashandiro ekudzinga kune ese mameseji echenjedzo ane plugin iyi.
Paunenge uchishandisa .close
bhatani, anofanira kunge ari mwana wekutanga weiyo .alert-dismissible
uye hapana mavara emukati anogona kuuya pamberi payo mumarkup.
Chinja ichi neicho uye woedza zvakare. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.
Ingo wedzera data-dismiss="alert"
kune yako bhatani rekuvhara kuti upe otomatiki yambiro yepedyo kushanda. Kuvhara yambiro kunoibvisa kubva kuDOM.
Kuti zviziviso zvako zvishandise animation paunenge uchivhara, ita shuwa kuti vane .fade
uye .in
makirasi atoiswa kwavari.
$().alert()
Inoita yambiro yekuteerera kune zviitiko zvekudzvanya pane zvedzinza zvine data-dismiss="alert"
hunhu. (Hazvina basa kana uchishandisa iyo data-api's auto-initialization.)
$().alert('close')
Inovhara yambiro nekuibvisa muDOM. Kana .fade
uye.in
makirasi aripo pane chinhu, yambiro inopera isati yabviswa.
Bootstrap's alert plugin inofumura zviitiko zvishoma zvekukochekera mune yambiro mashandiro.
Chiitiko Type | Tsanangudzo |
---|---|
close.bs.alert | Ichi chiitiko chinopisa nekukasira kana close nzira yemuenzaniso inodanwa. |
closed.bs.alert | Ichi chiitiko chinodzingwa kana yambiro yavharwa (ichamirira CSS shanduko kuti ipere). |
Ita zvakawanda nemabhatani. Kudzora bhatani rinotaura kana kugadzira mapoka emabhatani ezvimwe zvinhu zvakaita sematurusi.
Firefox inorambira fomu yekudzora nyika (kuremara uye kutariswa) pane ese peji mitoro . A workaround yeiyi kushandisa autocomplete="off"
. Ona Mozilla bug #654072 .
Wedzera data-loading-text="Loading..."
kushandisa mamiriro ekurodha pane bhatani.
Ichi chimiro chakaregwa kubvira v3.3.5 uye chakabviswa muv4.
Nekuda kwekuratidzira uku, tiri kushandisa data-loading-text
uye $().button('loading')
, asi handiyo yega nyika yaungashandisa. Ona zvakawanda pane izvi pazasi mune $().button(string)
zvinyorwa .
Wedzera data-toggle="button"
ku activate toggling pane rimwe bhatani.
.active
uyearia-pressed="true"
Kune mabhatani akafanotenderwa, iwe unofanirwa kuwedzera .active
kirasi uye aria-pressed="true"
hunhu kune button
iwe pachako.
Wedzera data-toggle="buttons"
kune .btn-group
ine cheki bhokisi kana redhiyo inopinza kuti igone kuchinjika mumataera avo.
.active
Kune sarudzo dzakafanosarudzwa, iwe unofanirwa kuwedzera .active
kirasi kune yekuisa label
iwe pachako.
Kana iyo yakatariswa yebhokisi rebhokisi yakagadziridzwa pasina kupfura click
chiitiko pabhatani (semuenzaniso kuburikidza <input type="reset">
kana kuburikidza nekuseta checked
chivakwa chekuisa), iwe uchafanirwa kushandura .active
kirasi pane yekuisa label
iwe pachako.
$().button('toggle')
Toggles push state. Inopa bhatani kutaridzika kuti rakaitwa.
$().button('reset')
Reset mamiriro ebhatani - chinjanisa mavara kuenda kumavara ekutanga. Iyi nzira ndeye asynchronous uye inodzoka kugadziridza kusati kwanyatsopera.
$().button(string)
Chinja mavara kune chero data yakatsanangurwa mamiriro emavara.
Flexible plugin inoshandisa mashoma emakirasi kuitira nyore kuchinja maitiro.
Kuputsika kunoda kuti shanduko yeplugin ibatanidzwe mushanduro yako yeBootstrap.
Dzvanya mabhatani ari pazasi kuratidza uye kuviga chimwe chinhu kuburikidza nekuchinja kwekirasi:
.collapse
anovanza zviri mukati.collapsing
inoshandiswa panguva yekuchinja.collapse.in
inoratidza zvirimoUnogona kushandisa chinongedzo chine href
hunhu, kana bhatani rine data-target
hunhu. Muzviitiko zvose izvi, data-toggle="collapse"
zvinodiwa.
Wedzera maitiro ekudonha kuti ugadzire accordion nechikamu chepaneru.
Izvo zvakare zvinogoneka kuchinjanisa kunze .panel-body
s ne .list-group
s.
Iva nechokwadi chekuwedzera aria-expanded
kune chekutonga chinhu. Hunhu uhu hunotsanangura zviripachena mamiriro azvino echinhu chinoputsika kuvaverengi vezvikirini uye matekinoroji ekubatsira akafanana. Kana iyo chinhu chinoputika chakavharwa nekukasira, chinofanira kunge chine kukosha kwe aria-expanded="false"
. Kana iwe wakaseta chinhu chinoputika kuti chivhurwe nekusarudzika uchishandisa in
kirasi, isa aria-expanded="true"
pane control pane. Iyo plugin inozoshandura hunhu uhu zvichibva pakuti chinhu chinopetana chavhurwa here kana kuti kwete.
Pamusoro pezvo, kana chinhu chako chekutonga chiri kunanga chinhu chimwe chinoputsika - kureva kuti data-target
hunhu huri kunongedza kune id
anosarudza - unogona kuwedzera humwe aria-controls
hunhu kuchinhu chekudzora, chine id
chechinhu chinoputika. Vaverengi vemazuva ano skrini uye matekinoroji ekubatsira akafanana anoshandisa hunhu uhwu kupa vashandisi mamwe mapfupi ekufamba akananga kuchinhu chinoputika pachacho.
Iyo yekudonha plugin inoshandisa mashoma makirasi kubata inorema kusimudza:
.collapse
inovanza zviri mukati.collapse.in
inoratidza zviri mukati.collapsing
inowedzerwa kana shanduko yatanga, uye inobviswa kana yaperaAya makirasi anogona kuwanikwa mu component-animations.less
.
Ingo wedzera data-toggle="collapse"
uye a data-target
kune chinhu kuti upe otomatiki kutonga kwechinhu chinoputika. Hunhu data-target
hunogamuchira CSS selector yekushandisa iyo kuputsika. Iva nechokwadi chekuwedzera kirasi collapse
kune chinhu chinoputika. Kana uchida kuti risavhurika, wedzera imwe kirasi in
.
Kuwedzera accordion-senge boka manejimendi kune inodonha kutonga, wedzera iyo data hunhu data-parent="#selector"
. Tarisa kune demo kuti uone izvi mukuita.
Vhura nemaoko ne:
Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-
, semu data-parent=""
.
Zita | type | default | tsananguro |
---|---|---|---|
mubereki | selector | nhema | Kana sarudzo yapihwa, zvese zvinopeta pasi pemubereki wataurwa zvichavharwa kana chinhu chinopetana ichi charatidzwa. (zvakafanana nemaitiro echinyakare accordion - izvi zvinoenderana panel nekirasi) |
toggle | boolean | chokwadi | Inoshandura chinhu chinopeta pakukumbira |
.collapse(options)
Inobatisa zvirimo sechinhu chinogoneka. Inobvuma sarudzo dzaungada object
.
.collapse('toggle')
Inoshandura chinhu chinopeta kuti chiratidze kana kuvanzwa. Inodzokera kune ari kufona chinhu chinopeta chisati charatidzwa kana kuvanzwa (kureva kuti shown.bs.collapse
kana hidden.bs.collapse
chiitiko chisati chaitika).
.collapse('show')
Inoratidza chinhu chinopeta. Inodzokera kumunhu arikufona chinhu chinopeta chisati charatidzwa (kureva kuti shown.bs.collapse
chiitiko chisati chaitika).
.collapse('hide')
Inoviga chinhu chinopeta. Inodzokera kumunhu arikufona chinhu chinopeta chisati chavanzwa (kureva kuti hidden.bs.collapse
chiitiko chisati chaitika).
Bootstrap's kudonha kirasi inofumura zviitiko zvishoma zvekukochekera mukudonha kushanda.
Chiitiko Type | Tsanangudzo |
---|---|
show.bs.collapse | Ichi chiitiko chinopisa nekukasira kana show nzira yemuenzaniso inodanwa. |
display.bs.collapse | Ichi chiitiko chinodzingwa kana chinhu chekudonha chaitwa kuti chionekwe kumushandisi (chinomirira kuti CSS shanduko ipedze). |
hide.bs.collapse | Chiitiko ichi chinodzingwa pakarepo kana hide nzira yadaidzwa. |
zvakavanzika.bs.collapse | Chiitiko ichi chinodzingwa kana chinhu chekudonha chakavigwa kubva kumushandisi (chinomirira kuti CSS shanduko ipedze). |
Chikamu chemasiraidhi chekuchovha bhasikoro kuburikidza nezvinhu, senge carousel. Nested carousels haatsigirwe.
Chikamu checarousel kazhinji hachienderane nezviyero zvekuwanikwa. Kana iwe uchida kutevedzera, ndokumbirawo utarise dzimwe sarudzo dzekuratidza zvirimo.
Bootstrap inoshandisa CSS3 chete kumifananidzo yayo, asi Internet Explorer 8 & 9 haitsigire zvivakwa zveCSS zvinodiwa. Saka, hapana masiraidhi ekuchinja mifananidzo kana uchishandisa mabhurawuza aya. Isu takasarudza nemaune kusabatanidza jQuery-based fallbacks yekuchinja.
Kirasi .active
inoda kuwedzerwa kune imwe yemasiraidhi. Kana zvisina kudaro, carousel haizooneki.
Iwo .glyphicon .glyphicon-chevron-left
uye .glyphicon .glyphicon-chevron-right
makirasi haafanirwe kudikanwa kune zvinodzora. Bootstrap inopa .icon-prev
uye .icon-next
seyakajeka unicode dzimwe nzira.
Wedzera zvinyorwa kune masiraidhi ako zviri nyore nechinhu .carousel-caption
chiri mukati mechero .item
. Isa ingangoita chero sarudzo yeHTML mukati imomo uye inozorongedzerwa otomatiki uye kufomatidzwa.
Carousels inoda kushandiswa kweiyo id
pamudziyo wekunze (iyo .carousel
) kuti carousel control ishande nemazvo. Paunenge uchiwedzera akawanda macarousels, kana kana uchichinja carousel's id
, ita shuwa yekuvandudza akakodzera kudzora.
Shandisa data hunhu kudzora zviri nyore chinzvimbo checarousel. data-slide
inogamuchira mazwi makuru prev
kana next
, iyo inoshandura nzvimbo yemasiraidhi maererano nenzvimbo yayo yazvino. Neimwe nzira, shandisa data-slide-to
kupfuudza masiraidhi indekisi ku carousel data-slide-to="2"
, iyo inoshandura nzvimbo yemasiraidhi kuenda kune imwe index inotanga na 0
.
Hunhu data-ride="carousel"
hunoshandiswa kumaka carousel seanorarama kutanga pakurodha peji. Haikwanise kushandiswa pamwe chete ne (zvisina basa uye zvisina basa) zvakajeka JavaScript kutanga kwekarosi imwechete.
Fonera carousel nemaoko ne:
Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-
, semu data-interval=""
.
Zita | type | default | tsananguro |
---|---|---|---|
interval | nhamba | 5000 | Huwandu hwenguva yekunonoka pakati pekuita bhasikoro chinhu. Kana nhema, carousel haizongotenderera ichitenderera. |
pause | tambo | null | "hovha" | Kana yaiswa kuti "hover" , inombomira kubhasikoro kwekarosi mouseenter yotangazve kuchovha bhasikoro pa mouseleave . Kana yaiswa kuti null , kudzengerera pamusoro pekarosi hakuzomire. |
wrap | boolean | chokwadi | Kunyangwe iyo carousel inofanirwa kutenderera ichitenderera kana kumira zvakaoma. |
keyboard | boolean | chokwadi | Kunyangwe iyo carousel inofanirwa kuita kune keyboard zviitiko. |
.carousel(options)
Inotanga carousel ine sarudzo yesarudzo object
uye inotanga kuchovha bhasikoro kuburikidza nezvinhu.
.carousel('cycle')
Kutenderera nepakati pezvinhu zvecarousel kubva kuruboshwe kuenda kurudyi.
.carousel('pause')
Inomisa carousel kubva kubhasikoro kuburikidza nezvinhu.
.carousel(number)
Inotenderedza carousel kune imwe furemu (0 yakavakirwa, yakafanana neyakarongwa).
.carousel('prev')
Kutenderera kune chinhu chapfuura.
.carousel('next')
Kutenderera kuenda kuchinhu chinotevera.
Bootstrap's carousel kirasi inofumura zviitiko zviviri zvekukochekera mukuita kwecarousel.
Zviitiko zviviri izvi zvine zvimwe zvinotevera:
direction
: Nzira iyo carousel iri kutsvedza (zvichida "left"
kana "right"
).relatedTarget
: Chinhu cheDOM chiri kutsvedzerwa panzvimbo sechinhu chinoshanda.Zvese zviitiko zvecarousel zvinodzingwa pacarousel pachayo (kureva pa <div class="carousel">
).
Chiitiko Type | Tsanangudzo |
---|---|
slide.bs.carousel | Ichi chiitiko chinopisa nekukasira kana slide nzira yemuenzaniso yakumbirwa. |
slid.bs.carousel | Ichi chiitiko chinodzingwa kana carousel yapedza shanduko yayo yemasiraidhi. |
Iyo affix plugin inobatidza nekudzima position: fixed;
, kutevedzera maitiro anowanikwa ne position: sticky;
. Iyo subnavigation kurudyi idemo mhenyu yeaffix plugin.
Shandisa iyo affix plugin kuburikidza ne data hunhu kana nemaoko neJavaScript yako. Mune ese ari maviri mamiriro, iwe unofanirwa kupa CSS yekumisikidza uye hupamhi hwezvako zvakanamirwa.
Ongorora: Usashandise affix plugin pane chinhu chiri muchinhu chakamira zvakati, senge koramu yakadhonzwa kana kusundidzirwa, nekuda kweSafari inopa bug .
Iyo affix plugin inochinja pakati pemakirasi matatu, imwe neimwe ichimiririra imwe nyika: .affix
, .affix-top
, uye .affix-bottom
. Iwe unofanirwa kupa masitaera, kunze kwe position: fixed;
on .affix
, kune aya makirasi iwe pachako (yakazvimirira yeiyi plugin) kubata izvo chaizvo zvinzvimbo.
Heino mashandiro anoita iyo affix plugin:
.affix-top
kuratidza chinhu chiri munzvimbo yayo yepamusoro-yakawanda. Panguva ino hapana CSS chinzvimbo chinodiwa..affix
panotsiva .affix-top
uye kuseta position: fixed;
(inopihwa neBootstrap's CSS)..affix
ne .affix-bottom
. Sezvo maoffsets ari sarudzo, kuseta imwe kunoda kuti uise CSS yakakodzera. Muchiitiko ichi, wedzera position: absolute;
kana zvichidiwa. Iyo plugin inoshandisa iyo data hunhu kana JavaScript sarudzo yekuona pekuisa chinhu kubva ipapo.Tevedza matanho ari pamusoro apa kuti uise CSS yako kune imwe yesarudzo dzekushandisa pazasi.
Kuti uwedzere nyore affix maitiro kune chero chinhu, ingo wedzera data-spy="affix"
kune chinhu chaunoda kunosora. Shandisa maoffset kutsanangura nguva yekushandura pining yechinhu.
Fonera iyo affix plugin kuburikidza neJavaScript:
Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-
, semu data-offset-top="200"
.
Zita | type | default | tsananguro |
---|---|---|---|
offset | nhamba | basa | object | 10 | MaPixels ekubvisa kubva pachiratidziro kana uchiverenga chinzvimbo chemupumburu. Kana nhamba imwe chete yapihwa, iyo yekubvisa inozoiswa mumativi ese epamusoro nepasi. Kupa yakasarudzika, yepasi uye yepamusoro offset ingopa chinhu offset: { top: 10 } kana offset: { top: 10, bottom: 5 } . Shandisa basa kana iwe uchida dynamically kuverengera offset. |
chinangwa | selector | node | jQuery element | window chinhu _ |
Inotsanangura chinongedzo chechinhu che affix. |
.affix(options)
Inobatisa zvirimo zvako sezvakanamirwa. Inobvuma sarudzo dzaungada object
.
.affix('checkPosition')
Inoverengerazve mamiriro eiyo affix zvichienderana nehukuru, chinzvimbo, uye chinzvimbo chemupumburu wezvinhu zvinoenderana. Iyo .affix
, .affix-top
, uye .affix-bottom
makirasi anowedzerwa kana kubviswa kubva pane zvakanamirwa zvinoenderana nenyika itsva. Iyi nzira inoda kudaidzwa pese kana zviyero zvezvakanamirwa kana chinhu chinotarirwa chashandurwa, kuve nechokwadi chekumisikidzwa kwezvakanamirwa.
Bootstrap's affix plugin inofumura zviitiko zvishoma zvekukochekera mune affix mashandiro.
Chiitiko Type | Tsanangudzo |
---|---|
affix.bs.affix | Chiitiko ichi chinopisa chinhu chisati chanamirwa. |
affixed.bs.affix | Chiitiko ichi chinodzingwa mushure mekunge chinhu chanamirwa. |
affix-top.bs.affix | Chiitiko ichi chinopisa chinhu chisati chanamirwa-pamusoro. |
affixed-top.bs.affix | Ichi chiitiko chinodzingwa mushure mekunge chinhu chanamirwa-pamusoro. |
namatidza-pasi.bs.affix | Ichi chiitiko chinopisa chinhu chisati chanamirwa-pasi. |
affixed-bottom.bs.affix | Ichi chiitiko chinodzingwa mushure mekunge chinhu chanamirwa-pasi. |