JavaScript
Kawo abubuwan haɗin Bootstrap zuwa rayuwa tare da fiye da dozin na al'ada jQuery plugins. A sauƙaƙe haɗa su duka, ko ɗaya bayan ɗaya.
Kawo abubuwan haɗin Bootstrap zuwa rayuwa tare da fiye da dozin na al'ada jQuery plugins. A sauƙaƙe haɗa su duka, ko ɗaya bayan ɗaya.
Ana iya haɗa plugins daban-daban (ta amfani da *.js
fayilolin guda ɗaya na Bootstrap), ko duka a lokaci ɗaya (amfani bootstrap.js
ko ƙarami bootstrap.min.js
).
Duka bootstrap.js
kuma bootstrap.min.js
sun ƙunshi duk plugins a cikin fayil ɗaya. Haɗa guda ɗaya kawai.
Wasu plugins da abubuwan CSS sun dogara da wasu plugins. Idan kun haɗa plugins daban-daban, tabbatar da bincika waɗannan abubuwan dogaro a cikin takaddun. Har ila yau lura cewa duk plugins sun dogara da jQuery (wannan yana nufin jQuery dole ne a haɗa shi kafin fayilolin plugin). Tuntuɓi mubower.json
don ganin waɗanne nau'ikan jQuery ne ake tallafawa.
Kuna iya amfani da duk Bootstrap plugins zalla ta hanyar API ɗin alama ba tare da rubuta layi ɗaya na JavaScript ba. Wannan shine API-aji na farko na Bootstrap kuma yakamata ya zama abin lura na farko lokacin amfani da plugin.
Wannan ya ce, a wasu yanayi yana iya zama kyawawa a kashe wannan aikin. Sabili da haka, muna kuma ba da ikon musaki sifa ta API ta hanyar cire duk abubuwan da suka faru akan takaddun suna tare da data-api
. Wannan yayi kama da haka:
A madadin, don ƙaddamar da takamaiman plugin ɗin, kawai haɗa sunan plugin ɗin azaman sarari suna tare da bayanan-api sunaye kamar haka:
Kada a yi amfani da sifofin bayanai daga plugins da yawa akan wannan kashi. Misali, maɓalli ba zai iya samun tip ɗin kayan aiki ba kuma ya juya modal. Don yin wannan, yi amfani da abin rufewa.
Mun kuma yi imanin ya kamata ku iya amfani da duk abubuwan Bootstrap kawai ta JavaScript API. Duk APIs na jama'a guda ɗaya ne, hanyoyin da za a iya sarƙa, da dawo da tarin da aka yi aiki da su.
Duk hanyoyin ya kamata su karɓi zaɓin zaɓi na zaɓi, kirtani wanda ke nufin wata hanya, ko ba komai (wanda ke fara plugin ɗin tare da halayen tsoho):
Kowane plugin kuma yana fallasa ɗanyen ginin sa akan wata Constructor
kadara: $.fn.popover.Constructor
. Idan kuna son samun misalan plugin ɗin, dawo da shi kai tsaye daga wani abu: $('[rel="popover"]').data('popover')
.
Kuna iya canza saitunan tsoho don plugin ta hanyar gyara abin plugin ɗin Constructor.DEFAULTS
:
Wani lokaci yana da mahimmanci a yi amfani da plugins Bootstrap tare da wasu tsarin UI. A cikin waɗannan yanayi, karon sararin samaniya na iya faruwa lokaci-lokaci. Idan wannan ya faru, kuna iya kiran .noConflict
plugin ɗin da kuke son mayar da darajar.
Bootstrap yana ba da al'amuran al'ada don yawancin ayyuka na musamman na plugins. Gabaɗaya, waɗannan suna zuwa ne a cikin sigar ɓarna ta ƙarshe da ta gabata - inda ƙarshen (misali show
) ke haifar da shi a farkon wani lamari, kuma sigar ɓangarorinsa na baya (misali shown
) yana haifar da ƙarshen aikin.
Tun daga 3.0.0, duk abubuwan da suka faru na Bootstrap an ba su suna.
Duk abubuwan da ba su da iyaka suna ba da preventDefault
ayyuka. Wannan yana ba da ikon dakatar da aiwatar da wani aiki kafin ya fara.
Za a iya isa ga sigar kowane na Bootstrap's jQuery plugins ta hanyar VERSION
mallakar maginin plugin ɗin. Misali, don plugin ɗin kayan aiki:
Bootstrap's plugins ba sa komawa baya musamman cikin alheri lokacin da aka kashe JavaScript. Idan kuna kula da ƙwarewar mai amfani a wannan yanayin, yi amfani <noscript>
da bayanin halin da ake ciki (da kuma yadda ake sake kunna JavaScript) ga masu amfani da ku, da/ko ƙara naku faɗuwar al'ada.
Bootstrap baya goyan bayan dakunan karatu na ɓangare na uku a hukumance kamar Prototype ko jQuery UI. Duk .noConflict
da abubuwan da aka raba suna, ana iya samun matsalolin daidaitawa waɗanda kuke buƙatar gyara da kanku.
Don sauƙaƙan tasirin canji, haɗa transition.js
sau ɗaya tare da sauran fayilolin JS. Idan kana amfani da abin da aka haɗa (ko rage) bootstrap.js
, babu buƙatar haɗa wannan - ya riga ya kasance a can.
Transition.js shine mataimaki na asali don transitionEnd
abubuwan da suka faru da kuma abin koyi na CSS. Sauran plugins ke amfani da shi don bincika tallafin canjin CSS da kuma kama canjin rataye.
Ana iya kashe canje-canje a duniya ta amfani da snippet JavaScript mai zuwa, wanda dole ne ya zo bayan transition.js
(ko bootstrap.js
, bootstrap.min.js
kamar yadda al'amarin ya kasance) an loda:
Modals an daidaita su, amma masu sassauƙa, maganganun tattaunawa tare da mafi ƙarancin aikin da ake buƙata da kuma rashin daidaituwa.
Tabbatar cewa kar a buɗe modal yayin da wani ke bayyane. Nuna modal fiye da ɗaya a lokaci guda yana buƙatar lambar al'ada.
Koyaushe gwada sanya lambar HTML na modal a cikin babban matsayi a cikin takaddun ku don guje wa wasu abubuwan da ke shafar bayyanar modal da/ko aikin.
Akwai wasu fa'idodi game da amfani da modal akan na'urorin hannu. Duba takaddun tallafin burauzan mu don cikakkun bayanai.
Saboda yadda HTML5 ke bayyana ma'anar tarukan sa, autofocus
sifa ta HTML ba ta da wani tasiri a cikin tsarin Bootstrap. Don cimma sakamako iri ɗaya, yi amfani da wasu JavaScript na al'ada:
Modal da aka yi tare da kai, jiki, da saitin ayyuka a cikin ƙafar ƙafa.
Juya modal ta JavaScript ta danna maɓallin da ke ƙasa. Zai zame ƙasa ya dushe daga saman shafin.
Tabbatar ƙara role="dialog"
da aria-labelledby="..."
, yin magana da taken modal, zuwa .modal
, da role="document"
kanta .modal-dialog
.
Bugu da ƙari, kuna iya ba da bayanin yanayin maganganun ku tare da aria-describedby
kan .modal
.
Shigar da bidiyon YouTube a cikin ƙirar yana buƙatar ƙarin JavaScript ba a cikin Bootstrap don dakatar da sake kunnawa ta atomatik da ƙari ba. Dubi wannan taimako mai taimako Stack Overflow post don ƙarin bayani.
Modals suna da girma dabam na zaɓi biyu, ana samun su ta azuzuwan gyara don sanya su akan .modal-dialog
.
Don ƙirar ƙirar da kawai ke bayyana maimakon faɗuwa don dubawa, cire .fade
ajin daga alamar ƙirar ku.
Don amfani da tsarin grid na Bootstrap a cikin modal, kawai nest .row
s cikin .modal-body
sa'an nan kuma yi amfani da azuzuwan tsarin grid na yau da kullun.
Kuna da gungun maɓallai waɗanda duk ke haifar da modal iri ɗaya, kawai tare da abun ciki daban-daban? Yi amfani event.relatedTarget
da halayen HTMLdata-*
(yiwuwar ta jQuery ) don bambanta abubuwan da ke cikin tsarin ya danganta da wane maballin da aka danna. Dubi Dokokin Modal Events don cikakkun bayanai akan relatedTarget
,
Modal plugin yana jujjuya abubuwan da ke ɓoye akan buƙatu, ta hanyar sifofin bayanai ko JavaScript. Hakanan yana ƙarawa .modal-open
don <body>
soke halayen gungurawa na asali kuma yana haifar da .modal-backdrop
don samar da wurin dannawa don korar abubuwan da aka nuna lokacin dannawa wajen modal.
Kunna modal ba tare da rubuta JavaScript ba. Saita data-toggle="modal"
a kan abin sarrafawa, kamar maɓalli, tare da data-target="#foo"
ko href="#foo"
don ƙaddamar da takamaiman tsari don juyawa.
Kira modal tare da id myModal
tare da layi ɗaya na JavaScript:
Za a iya wucewa ta hanyar sifofin bayanai ko JavaScript. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-backdrop=""
.
Suna | nau'in | tsoho | bayanin |
---|---|---|---|
baya | boolean ko kirtani'static' |
gaskiya | Ya ƙunshi nau'in modal-backdrop. A madadin, saka static don bayanan baya wanda baya rufe tsarin a dannawa. |
keyboard | boolean | gaskiya | Yana rufe tsarin lokacin da aka danna maɓallin guduwa |
nuna | boolean | gaskiya | Yana nuna tsarin lokacin farawa. |
m | hanya | karya | An soke wannan zaɓi tun v3.3.0 kuma an cire shi a v4. Muna ba da shawarar maimakon yin amfani da samfuri-gefen abokin ciniki ko tsarin daurin bayanai, ko kiran jQuery.load da kanku. Idan an samar da URL mai nisa, za a loda abun ciki sau ɗaya ta hanyar jQuery |
.modal(options)
Yana kunna abun cikin ku azaman tsari. Yana yarda da zaɓin zaɓi object
.
.modal('toggle')
Da hannu yana jujjuya modal. Komawa ga mai kira kafin a nuna tsarin a zahiri ko ɓoye (watau kafin abin shown.bs.modal
ko hidden.bs.modal
abin ya faru).
.modal('show')
Da hannu yana buɗe modal. Komawa ga mai kira kafin a nuna ainihin tsari (watau kafin shown.bs.modal
abin ya faru).
.modal('hide')
Da hannu yana ɓoye modal. Komawa ga mai kira kafin a ɓoye tsarin (watau kafin hidden.bs.modal
abin ya faru).
.modal('handleUpdate')
Yana gyara madaidaicin modal don fuskantar gungurawa idan mutum ya bayyana, wanda zai sa tsarin ya yi tsalle zuwa hagu.
Ana buƙata kawai lokacin da tsayin yanayin ya canza yayin buɗewa.
Ajin modal na Bootstrap yana fallasa ƴan abubuwan da suka faru don haɗawa cikin ayyukan modal.
Duk abubuwan da suka faru na modal ana harba su akan modal kanta (watau a <div class="modal">
).
Nau'in Taron | Bayani |
---|---|
nuna.bs.modal | Wannan taron yana gobara nan da nan lokacin da show aka kira hanyar misali. Idan dannawa ya haifar, ana samun ɓangaren da aka latsa azaman relatedTarget mallakin taron. |
nuna.bs.modal | Ana korar wannan taron lokacin da aka bayyana yanayin ga mai amfani (zai jira canjin CSS ya kammala). Idan dannawa ya haifar, ana samun ɓangaren da aka latsa azaman relatedTarget mallakin taron. |
boye.bs.modal | Ana korar wannan taron nan da nan lokacin da hide aka kira hanyar misali. |
boye.bs.modal | Ana korar wannan taron lokacin da tsarin ya gama ɓoyewa daga mai amfani (zai jira canjin CSS ya kammala). |
ɗora Kwatancen.bs.modal | Ana korar wannan taron lokacin da tsarin ya loda abun ciki ta amfani da remote zaɓi. |
Ƙara menu na zaɓuka zuwa kusan komai tare da wannan plugin ɗin mai sauƙi, gami da navbar, shafuka, da kwayoyi.
Ta hanyar sifofin bayanai ko JavaScript, zazzage plugin ɗin yana jujjuya abun ciki na ɓoye (menun zaɓuka) ta hanyar jujjuya .open
aji akan abin jerin iyaye.
A kan na'urorin tafi-da-gidanka, buɗe jerin zaɓuka yana ƙara .dropdown-backdrop
azaman yanki na famfo don rufe menu na zazzage lokacin dannawa wajen menu, buƙatu don ingantaccen tallafin iOS. Wannan yana nufin canzawa daga menu na buɗewa zuwa menu na zaɓuka daban yana buƙatar ƙarin taɓawa akan wayar hannu.
Lura: An data-toggle="dropdown"
dogara da sifa don rufe menu na zazzagewa a matakin aikace-aikacen, don haka yana da kyau a yi amfani da shi koyaushe.
Ƙara data-toggle="dropdown"
zuwa hanyar haɗi ko maɓalli don kunna zazzagewa.
Don kiyaye URLs tare da maɓallan mahaɗi, yi amfani da data-target
sifa maimakon href="#"
.
Kira zazzagewar ta hanyar JavaScript:
data-toggle="dropdown"
har yanzu ake bukataKo da kun kira zazzagewar ku ta JavaScript ko kuma a maimakon haka amfani da data-api, data-toggle="dropdown"
ana buƙatar koyaushe don kasancewa akan abubuwan faɗakarwa.
Babu
$().dropdown('toggle')
Yana jujjuya menu na zaɓuka na mashigar kewayawa da aka bayar ko kewayawa da aka buga.
Duk abubuwan da suka faru na zazzage ana harba su ne akan .dropdown-menu
ɓangaren iyaye.
Duk abubuwan da suka faru na zazzagewa suna da wata relatedTarget
kadara, wacce ƙimarta ita ce ɓangarorin anka mai juyawa.
Nau'in Taron | Bayani |
---|---|
nuna.bs. saukarwa | Wannan taron yana gobara nan da nan lokacin da aka kira hanyar misalin nuni. |
an nuna.bs. saukarwa | Ana korar wannan taron lokacin da aka bayyana zazzagewa ga mai amfani (zai jira canjin CSS, don kammala). |
boye.bs. saukarwa | Ana korar wannan taron nan da nan lokacin da aka kira hanyar misalin ɓoye. |
boye.bs. saukarwa | Ana kora wannan taron lokacin da jerin abubuwan da aka gama ɓoye daga mai amfani (zai jira canjin CSS, don kammala). |
The ScrollSpy plugin shine don sabunta makasudin nav ta atomatik dangane da matsayin gungurawa. Gungura wurin da ke ƙasa da maɓallin kewayawa kuma duba canjin aji mai aiki. Za a kuma haskaka ƙananan abubuwan da aka zazzage su ma.
Ad leggings keytar, brunch id art party dolor labour. Pitchfork yr enim lo-fi kafin su sayar da qui. Tumblr gona-zuwa tebur haƙƙin keke komai. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby suwaita lomo Jean shorts, williamsburg hoodie minim qui mai yiwuwa ba ku ji labarin su ba da cardigan Trust fund culpa biodiesel wes anderson aesthetical. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
Veniam marfa gashin baki skateboard, adipisicing fugiat velit pitchfork gemu. Freegan gemu aliqua cupidatat mcsweeney's vero. Cupidatat guda huɗu loko nisi, da helvetica nulla carles. Tattooed cosby sweater truck abinci, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles ba kayan motsa jiki ba yana buƙatar kulawa. Brooklyn adipisicing craft giya mataimakin keytar desrunt.
Occaecat commodo aliqua delectus. Fap craft giya deserunt skateboard ea. Haƙƙin keke na Lomo adipisicing banh mi, velit ea sunt next level locavore kofi na asali guda a magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS yana da matukar damuwa. Consectetur nisi DIY minim jakar jaka. Cred ex in, dorewa delectus consectetur fanny fakitin 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 jakar marfa duk abin da motar abinci ta delectus. Sapiente synth id zatonnda. Locavore sed helvetica cliche irony, tsawa mai yiwuwa ba ku ji labarin su ba sakamakon hoodie gluten-free lo-fi fap aliquip. Labour elit placeat kafin su sayar da su, Terry Richardson proident brunch nesciunt quis cosby suweter pariatur keffiyeh ut helvetica artisan. Cardigan craft giya seitan readymade velit. VHS chambray labs na dan lokaci veniam. Anim mollit minim commodo ullamco thundercats.
Dole ne hanyoyin haɗin Navbar su kasance da maƙasudin id masu warwarewa. Misali, <a href="#home">home</a>
dole ne ya dace da wani abu a cikin DOM kamar <div id="home"></div>
.
:visible
da ba manufa ba sun yi watsi da suAbubuwan da ba su :visible
dace da jQuery ba za a yi watsi da su kuma ba za a taɓa haskaka abubuwan da suka dace ba.
Komai hanyar aiwatarwa, scrollspy yana buƙatar amfani da abun da position: relative;
kuke leƙo asirin ƙasa. A mafi yawan lokuta wannan shine <body>
. Lokacin gungurawa akan abubuwan da ba na <body>
, tabbatar an sami height
saiti kuma overflow-y: scroll;
a yi amfani da su.
Don ƙara halayyar scrollspy cikin sauƙi zuwa kewayawa na saman mashaya, ƙara data-spy="scroll"
zuwa ɓangaren da kuke son yin rahõto a kai (mafi yawanci wannan shine <body>
). Sannan ƙara data-target
sifa tare da ID ko aji na ɓangaren mahaifa na kowane .nav
ɓangaren Bootstrap.
Bayan ƙara position: relative;
a cikin CSS ɗin ku, kira gungurawa ta hanyar JavaScript:
.scrollspy('refresh')
Lokacin amfani da scrollspy tare da ƙara ko cire abubuwa daga DOM, kuna buƙatar kiran hanyar wartsakewa kamar haka:
Za a iya wucewa ta hanyar sifofin bayanai ko JavaScript. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-offset=""
.
Suna | nau'in | tsoho | bayanin |
---|---|---|---|
biya diyya | lamba | 10 | Pixels don kashewa daga sama yayin ƙididdige matsayi na gungurawa. |
Nau'in Taron | Bayani |
---|---|
kunna.bs.scrollspy | Wannan taron yana ƙonewa a duk lokacin da sabon abu ya kunna ta hanyar gungurawa. |
Ƙara aikin shafin mai sauri, mai ƙarfi don canzawa ta cikin fakitin abun ciki na gida, har ma ta menu na zazzagewa. Ba a tallafawa shafuka masu gida.
Raw denim tabbas ba ku ji labarin su jeans shorts Austin ba. Nesciunt tofu stumptown aliqua, retro synth master cleanse. gashin baki cliche tempor, williamsburg carles vegan helvetica. Reprehenderit mahauci retro keffiyeh dreamcatcher synth. Cosby suwaita eu banh mi, qui irure terry richardson ex squid. Yadda ake yin salvia cillum iphone. Seitan aliquip quis cardigan Amurka tufafi, mahauta 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.
Wannan plugin ɗin yana faɗaɗa ɓangaren kewayawa da aka buga don ƙara wuraren da za a iya ɗaurewa.
Kunna shafukan da za a iya amfani da su ta hanyar JavaScript (kowane shafin yana buƙatar kunna shi daban):
Kuna iya kunna shafuka guda ɗaya ta hanyoyi da yawa:
Kuna iya kunna shafi ko kewayawa kwaya ba tare da rubuta kowane JavaScript ba ta hanyar tantancewa kawai data-toggle="tab"
ko data-toggle="pill"
akan wani abu. Ƙara da nav
kuma nav-tabs
azuzuwan zuwa shafin ul
zai yi amfani da Bootstrap shafin salo , yayin da ƙara nav
kuma nav-pills
azuzuwan za su yi amfani da salo na kwaya .
Don sanya shafuka su shuɗe, ƙara .fade
zuwa kowane .tab-pane
. Rukunin shafin farko kuma dole ne ya .in
sanya abun cikin farko a bayyane.
$().tab
Yana kunna abun shafi da kwandon abun ciki. Tab ya kamata ya kasance yana da ko dai data-target
ko wani href
kumburin kwantena mai niyya a cikin DOM. A cikin misalan da ke sama, shafuka sune <a>
s masu data-toggle="tab"
halaye.
.tab('show')
Yana zaɓar shafin da aka bayar kuma yana nuna abun ciki mai alaƙa. Duk wani shafin da aka zaɓa a baya ya zama ba zaɓaɓɓe ba kuma abun ciki mai alaƙa yana ɓoye. Komawa ga mai kira kafin a nuna ainihin ɓangaren shafin (watau kafin shown.bs.tab
abin ya faru).
Lokacin nuna sabon shafin, abubuwan da suka faru sun yi wuta a cikin tsari mai zuwa:
hide.bs.tab
(a kan shafin mai aiki na yanzu)show.bs.tab
(a kan shafin da za a nuna)hidden.bs.tab
(a kan shafin da ya gabata mai aiki, iri ɗaya da na hide.bs.tab
taron)shown.bs.tab
(akan sabon shafin da aka nuna, iri ɗaya da na show.bs.tab
taron)Idan babu shafin da ya riga ya fara aiki, to ba za a kori abubuwan hide.bs.tab
da abubuwan da suka faru ba.hidden.bs.tab
Nau'in Taron | Bayani |
---|---|
nuna.bs.tab | Wannan taron yana gobara akan nunin shafin, amma kafin a nuna sabon shafin. Yi amfani event.target da event.relatedTarget niyya shafi mai aiki da shafin da ya gabata (idan akwai) bi da bi. |
nuna.bs.tab | Wannan taron yana gobara akan nunin shafin bayan an nuna shafin. Yi amfani event.target da event.relatedTarget niyya shafi mai aiki da shafin da ya gabata (idan akwai) bi da bi. |
boye.bs.tab | Wannan taron yana ƙone lokacin da za a nuna sabon shafin (don haka za a ɓoye shafin da ya gabata). Yi amfani event.target da event.relatedTarget niyya shafi mai aiki na yanzu da sabon shafin da za a yi aiki nan ba da jimawa ba, bi da bi. |
boye.bs.tab | Wannan taron yana gobara bayan an nuna sabon shafin (saboda haka shafin da ya gabata yana ɓoye). Yi amfani event.target da event.relatedTarget niyya shafi na baya mai aiki da sabon shafin mai aiki, bi da bi. |
Ƙaddamar da kyakkyawan jQuery.tipsy plugin wanda Jason Frame ya rubuta; Tukwici kayan aiki sigar da aka sabunta ne, waɗanda ba su dogara da hotuna ba, amfani da CSS3 don rayarwa, da sifofin bayanai don ajiyar take na gida.
Ba a taɓa nuna nassoshin kayan aiki masu tsayin sifili ba.
Tsallake kan hanyoyin da ke ƙasa don ganin tukwici na kayan aiki:
Tattara wando next level keffiyeh kila ba ki ji labarin su ba. Hoton hoton gemu raw denim wasiƙar vegan messenger jakar stumptown. Farm-to-tebur seitan, mcsweeney's fixie mai dorewa quinoa 8-bit tufafin Amurka suna da terry Richardson vinyl chambray. Gemu stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, hudu loko mcsweeney's tsabtace vegan chambray. A really ironic artisan whatever keytar , scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin kofi viral.
Akwai zaɓuɓɓuka huɗu: saman, dama, ƙasa, da hagu masu layi.
Don dalilan aiki, Tooltip da Popover data-apis suna shiga, ma'ana dole ne ka fara su da kanka .
Hanya ɗaya don fara duk shawarwarin kayan aiki akan shafi shine zaɓi su ta yanayin su data-toggle
:
Filogin kayan aiki yana haifar da abun ciki da alama akan buƙata, kuma ta tsohuwa wuraren abubuwan kayan aiki bayan abubuwan jawo su.
Ƙaddamar da kayan aiki ta hanyar JavaScript:
Alamar da ake buƙata don tip ɗin kayan aiki data
sifa ce kawai kuma title
akan ɓangarorin HTML ɗin da kuke son samun tip ɗin kayan aiki. Samfuran alamar kayan aiki yana da sauƙi, kodayake yana buƙatar matsayi (ta tsohuwa, an saita shi top
ta plugin).
Wani lokaci kana so ka ƙara kayan aiki zuwa hyperlink wanda ke kunshe da layukan da yawa. Dalili na tsohowar kayan aikin kayan aiki shine a tsakiya shi a kwance da a tsaye. Ƙara white-space: nowrap;
zuwa anka don guje wa wannan.
Lokacin amfani da tukwici akan abubuwan da ke cikin wani .btn-group
ko .input-group
, ko akan abubuwan da ke da alaƙa da tebur ( <td>
, <th>
, <tr>
, , , , , , , , <thead>
, <tbody>
, <tfoot>
) dole ne ku ƙayyade zaɓi container: 'body'
(wanda aka rubuta a ƙasa) don guje wa illolin da ba'a so (kamar kashi na girma da girma da/ ko rasa sasanninta masu zagaye lokacin da aka kunna tip ɗin kayan aiki).
Don masu amfani da ke kewayawa da madannai, musamman masu amfani da fasahar taimako, yakamata ku ƙara nasihu na kayan aiki zuwa abubuwan da za a iya mayar da hankali kan madannai kamar hanyoyin haɗin kai, sarrafa tsari, ko duk wani abu na sabani tare da tabindex="0"
sifa.
Don ƙara tip ɗin kayan aiki zuwa wani abu disabled
ko .disabled
kashi, sanya kashi a cikin wani <div>
kuma yi amfani da tip ɗin a <div>
maimakon haka.
Za a iya wucewa ta hanyar sifofin bayanai ko JavaScript. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-animation=""
.
Suna | Nau'in | Tsohuwar | Bayani |
---|---|---|---|
tashin hankali | boolean | gaskiya | Aiwatar da canjin CSS fade zuwa tip ɗin kayan aiki |
ganga | zaren | karya | karya | Yana haɗa tip ɗin kayan aiki zuwa takamaiman yanki. Misali |
jinkiri | lamba | abu | 0 | Jinkirin nunawa da ɓoye bayanan kayan aiki (ms) - baya aiki ga nau'in fararwa na hannu Idan an ba da lamba, ana amfani da jinkiri ga duka ɓoye/nunawa Tsarin abu shine: |
html | boolean | karya | Saka HTML cikin kayan aiki. Idan ƙarya, text za a yi amfani da hanyar jQuery don saka abun ciki a cikin DOM. Yi amfani da rubutu idan kun damu da harin XSS. |
jeri | zaren | aiki | ' saman' | Yadda ake sanya kayan aiki - saman | kasa | hagu | dama | mota. Lokacin da aka yi amfani da aiki don ƙayyade wuri, ana kiran shi tare da kayan aiki na DOM node a matsayin hujja ta farko da maɓallin DOM mai jawowa a matsayin na biyu. An |
mai zaɓe | kirtani | karya | Idan an samar da mai zaɓe, za a ba da abubuwan da suka shafi kayan aiki zuwa takamaiman maƙasudai. A aikace, ana amfani da wannan don ba da damar abun ciki na HTML mai ƙarfi don ƙara ƙarin bayanan kayan aiki. Dubi wannan da misali mai ba da labari . |
samfuri | kirtani | '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' |
Tushen HTML don amfani yayin ƙirƙirar tukwici. Za a yi allurar kayan aiki
Abun nadi na waje yakamata ya kasance yana da |
take | zaren | aiki | '' | Tsohuwar ƙimar take idan babu Idan an ba da aiki, za a kira shi tare da |
jawo | kirtani | 'Hover focus' | Yadda ake kunna tip ɗin kayan aiki - danna | shawa | mayar da hankali | manual. Kuna iya wuce abubuwan jan hankali da yawa; raba su da sarari. manual ba za a iya haɗa shi da wani abin tayar da hankali ba. |
kallon kallo | zaren | abu | aiki | {mai zaɓe: 'jiki', padding: 0} | Yana kiyaye tip ɗin kayan aiki a cikin iyakokin wannan kashi. Misali: Idan an ba da aiki, ana kiran shi tare da kumburin DOM mai jawo a matsayin hujja kawai. An |
Zaɓuɓɓuka don ƙayyadaddun bayanan kayan aiki ɗaya na iya zama a madadin ta hanyar amfani da sifofin bayanai, kamar yadda aka bayyana a sama.
$().tooltip(options)
Haɗa mai sarrafa kayan aiki zuwa tarin abubuwa.
.tooltip('show')
Yana bayyana matakin kayan aiki. Komawa ga mai kira kafin a nuna matakin kayan aiki (watau kafin shown.bs.tooltip
abin ya faru). Ana ɗaukar wannan a matsayin "manual" mai kunna tip ɗin kayan aiki. Ba a taɓa nuna nassoshin kayan aiki masu tsayin sifili ba.
.tooltip('hide')
Yana ɓoye bayanan kayan aiki. Komawa ga mai kira kafin a ɓoye bayanan kayan aiki (watau kafin hidden.bs.tooltip
abin ya faru). Ana ɗaukar wannan a matsayin "manual" mai kunna tip ɗin kayan aiki.
.tooltip('toggle')
Yana jujjuya matakin kayan aiki. Komawa ga mai kira kafin a nuna tip ɗin kayan aiki a zahiri ko a ɓoye (watau kafin abin shown.bs.tooltip
ko hidden.bs.tooltip
abin ya faru). Ana ɗaukar wannan a matsayin "manual" mai kunna tip ɗin kayan aiki.
.tooltip('destroy')
Yana ɓoyewa kuma yana lalata tushen kayan aiki. Nasihun kayan aiki waɗanda ke amfani da wakilai (wanda aka ƙirƙira ta amfani da selector
zaɓi ) ba za a iya lalata su daban-daban akan abubuwan da ke haifar da zuriya ba.
Nau'in Taron | Bayani |
---|---|
nuna.bs.tooltip | Wannan taron yana gobara nan da nan lokacin da show aka kira hanyar misali. |
nuna.bs.tooltip | Ana korar wannan taron ne lokacin da aka bayyana kayan aikin ga mai amfani (zai jira canjin CSS ya kammala). |
boye.bs.tooltip | Ana korar wannan taron nan da nan lokacin da hide aka kira hanyar misali. |
boye.bs.tooltip | Ana kora wannan taron lokacin da kayan aikin ya gama ɓoye daga mai amfani (zai jira canjin CSS ya kammala). |
shigar.bs.tooltip | An kori wannan taron bayan show.bs.tooltip taron lokacin da aka ƙara samfurin kayan aiki zuwa DOM. |
Ƙara ƙarami mai rufi na abun ciki, kamar waɗanda ke kan iPad, zuwa kowane nau'i na bayanan sakandare na gidaje.
Popovers waɗanda duka take da abun ciki ba tsawon sifili ba ba a taɓa nunawa ba.
Popovers suna buƙatar kayan aikin tukwici don haɗa su cikin sigar Bootstrap ɗin ku.
Don dalilan aiki, Tooltip da Popover data-apis suna shiga, ma'ana dole ne ka fara su da kanka .
Hanya ɗaya don fara duk popovers akan shafi shine zaɓi su ta hanyar data-toggle
halayensu:
Lokacin amfani da popovers akan abubuwan da ke cikin wani .btn-group
ko .input-group
, ko akan abubuwan da ke da alaƙa ( <td>
, <th>
, <tr>
, , , , <thead>
, <tbody>
, <tfoot>
), dole ne ku ƙayyade zaɓi container: 'body'
(wanda aka rubuta a ƙasa) don guje wa illolin da ba'a so (kamar ɓangaren da ke girma da fadi da/ ko rasa sasanninta masu zagaye lokacin da aka kunna popover).
Don ƙara popover zuwa wani abu disabled
ko .disabled
element, sanya kashi a cikin wani <div>
kuma yi amfani da popover a <div>
maimakon haka.
Wani lokaci kana so ka ƙara popover zuwa hyperlink wanda ke kunshe da layi daya. Dalili na tsohowar plugin ɗin popover shine a tsakiya shi a kwance da a tsaye. Ƙara white-space: nowrap;
zuwa anka don guje wa wannan.
Akwai zaɓuɓɓuka huɗu: saman, dama, ƙasa, da hagu masu layi.
Sed posuere consectetur est a lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est a lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est a lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est a lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Yi amfani da focus
faɗakarwa don korar popovers akan danna gaba wanda mai amfani yayi.
Don ingantaccen mai binciken giciye da kuma halayyar dandamali, dole ne ku yi amfani da <a>
alamar, ba alamar ba <button>
, kuma dole ne ku haɗa role="button"
da tabindex
sifofi.
Kunna popovers ta JavaScript:
Za a iya wucewa ta hanyar sifofin bayanai ko JavaScript. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-animation=""
.
Suna | Nau'in | Tsohuwar | Bayani |
---|---|---|---|
tashin hankali | boolean | gaskiya | Aiwatar da canjin Fade CSS zuwa popover |
ganga | zaren | karya | karya | Haɗa popover zuwa takamaiman yanki. Misali |
abun ciki | zaren | aiki | '' | Ƙimar abun ciki na asali idan Idan an ba da aiki, za a kira shi tare da |
jinkiri | lamba | abu | 0 | Jinkirin nunawa da ɓoye popover (ms) - baya shafi nau'in fararwa na hannu Idan an ba da lamba, ana amfani da jinkiri ga duka ɓoye/nunawa Tsarin abu shine: |
html | boolean | karya | Saka HTML a cikin popover. Idan ƙarya, text za a yi amfani da hanyar jQuery don saka abun ciki a cikin DOM. Yi amfani da rubutu idan kun damu da harin XSS. |
jeri | zaren | aiki | 'dama' | Yadda ake sanya popover - top | kasa | hagu | dama | mota. Lokacin da aka yi amfani da aiki don ƙayyade wurin, ana kiran shi tare da kumburin DOM popover a matsayin hujjarsa ta farko da maɓallin DOM mai jawowa a matsayin na biyu. An |
mai zaɓe | kirtani | karya | Idan an samar da mai zaɓe, za a ba da abubuwan da za a yi amfani da su zuwa takamaiman maƙasudan. A aikace, ana amfani da wannan don ba da damar abun ciki na HTML mai ƙarfi don ƙara fa'ida. Dubi wannan da misali mai ba da labari . |
samfuri | kirtani | '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' |
Tushen HTML don amfani yayin ƙirƙirar popover. Za a yi allurar popover Za a yi allurar popover
Abun nadi na waje yakamata ya kasance yana da |
take | zaren | aiki | '' | Tsohuwar ƙimar take idan babu Idan an ba da aiki, za a kira shi tare da |
jawo | kirtani | 'danna' | Yadda ake kunna popover - danna | shawa | mayar da hankali | manual. Kuna iya wuce abubuwan jan hankali da yawa; raba su da sarari. manual ba za a iya haɗa shi da wani abin tayar da hankali ba. |
kallon kallo | zaren | abu | aiki | {mai zaɓe: 'jiki', padding: 0} | Yana kiyaye popover a cikin iyakokin wannan kashi. Misali: Idan an ba da aiki, ana kiran shi tare da kumburin DOM mai jawo a matsayin hujja kawai. An |
Zaɓuɓɓuka don faɗuwar faɗuwar mutum ɗaya ana iya a madadin su ta hanyar amfani da sifofin bayanai, kamar yadda aka bayyana a sama.
$().popover(options)
Yana farawa popovers don tarin abubuwa.
.popover('show')
Yana bayyana faɗuwar wani abu. Komawa ga mai kira kafin a nuna popover a zahiri (watau kafin shown.bs.popover
abin ya faru). Ana ɗaukar wannan a matsayin "manual" yana haifar da popover. Popovers waɗanda duka take da abun ciki ba tsawon sifili ba ba a taɓa nunawa ba.
.popover('hide')
Yana ɓoye ɓoyayyen abu. Komawa ga mai kira kafin a ɓoye popover a zahiri (watau kafin hidden.bs.popover
abin ya faru). Ana ɗaukar wannan a matsayin "manual" yana haifar da popover.
.popover('toggle')
Yana jujjuya faɗuwar wani abu. Komawa ga mai kira kafin a nuna ko ɓoye a zahiri (watau kafin abin shown.bs.popover
ko hidden.bs.popover
abin ya faru). Ana ɗaukar wannan a matsayin "manual" yana haifar da popover.
.popover('destroy')
Yana ɓoyewa da lalata faɗuwar wani abu. Popovers da ke amfani da wakilai (waɗanda aka ƙirƙira ta amfani da selector
zaɓi ) ba za a iya lalata su daban-daban akan abubuwan da ke haifar da zuriya ba.
Nau'in Taron | Bayani |
---|---|
nuna.bs.popover | Wannan taron yana gobara nan da nan lokacin da show aka kira hanyar misali. |
nuna.bs.popover | Ana korar wannan taron lokacin da aka bayyana popover ga mai amfani (zai jira canjin CSS ya kammala). |
boye.bs.popover | Ana korar wannan taron nan da nan lokacin da hide aka kira hanyar misali. |
boye.bs.popover | Ana kora wannan taron lokacin da popover ya gama ɓoyewa daga mai amfani (zai jira canjin CSS ya kammala). |
shigar.bs.popover | An kori wannan taron bayan show.bs.popover taron lokacin da aka ƙara samfurin popover zuwa DOM. |
Ƙara aikin korar zuwa duk saƙonnin faɗakarwa tare da wannan plugin ɗin.
Lokacin amfani da .close
maɓalli, dole ne ya zama ɗan fari na farko .alert-dismissible
kuma babu wani abun ciki na rubutu da zai iya zuwa gabansa a cikin alamar.
Canza wannan da wancan kuma a sake gwadawa. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras Mattis consectetur purus zauna amet fermentum.
Kawai ƙara data-dismiss="alert"
zuwa maɓallin ku don ba da aikin kusa da faɗakarwa ta atomatik. Rufe faɗakarwa yana cire shi daga DOM.
Don samun faɗakarwar ku ta yi amfani da rayarwa lokacin rufewa, tabbatar suna da .fade
kuma.in
azuzuwan da azuzuwan.
$().alert()
Yana sa faɗakarwa yana saurare don danna abubuwan da suka faru a kan abubuwan da suka fito waɗanda ke da data-dismiss="alert"
sifa. (Ba lallai ba ne lokacin amfani da bayanan-api ta atomatik-farawa.)
$().alert('close')
Yana rufe faɗakarwa ta cire shi daga DOM. Idan azuzuwan .fade
suna .in
nan akan kashi, faɗakarwar zata shuɗe kafin a cire ta.
Flugin faɗakarwar Bootstrap yana fallasa ƴan abubuwan da suka faru don haɗawa cikin ayyukan faɗakarwa.
Nau'in Taron | Bayani |
---|---|
kusa.bs.jijjiga | Wannan taron yana gobara nan da nan lokacin da close aka kira hanyar misali. |
rufaffiyar.bs.jijjiga | Ana kora wannan taron lokacin da aka rufe faɗakarwa (zai jira canjin CSS don kammala). |
Yi ƙari tare da maɓalli. Maɓallin sarrafawa ko ƙirƙiri ƙungiyoyin maɓalli don ƙarin abubuwan haɗin gwiwa kamar sandunan kayan aiki.
Firefox ta ci gaba da kasancewa jihohin sarrafa nau'ikan nau'ikan nau'ikan nau'ikan nau'ikan nau'ikan nau'ikan nau'ikan nau'ikan nau'ikan nau'ikan nau'ikan nau'ikan nau'ikan nau'ikan sarrafawa (naƙasuwa da bincikawa) a cikin lodin shafi . Hanyar da za a yi amfani da ita don wannan shine autocomplete="off"
. Duba kwaro na Mozilla #654072 .
Ƙara data-loading-text="Loading..."
don amfani da yanayin lodi akan maɓalli.
Wannan fasalin an soke shi tun v3.3.5 kuma an cire shi a cikin v4.
Saboda wannan zanga-zangar, muna amfani data-loading-text
da $().button('loading')
, amma wannan ba shine kaɗai jihar da zaku iya amfani da ita ba. Dubi ƙarin akan wannan a ƙasa a cikin $().button(string)
takaddun .
Ƙara data-toggle="button"
don kunna juyawa akan maɓalli ɗaya.
.active
kumaaria-pressed="true"
Don maɓallan da aka riga aka kunna, dole ne ku ƙara .active
ajin da aria-pressed="true"
sifa ga button
kanku.
Ƙara data-toggle="buttons"
zuwa .btn-group
akwati mai ƙunshe da abubuwan shigar da rediyo don ba da damar jujjuyawa cikin salo daban-daban.
.active
Don zaɓin da aka riga aka zaɓa, dole ne ka ƙara .active
ajin zuwa abubuwan shigar da label
kanka.
Idan an sabunta maballin akwati da aka duba ba tare da harba wani click
abu akan maballin ba (misali ta hanyar <input type="reset">
ko ta hanyar saita checked
kayan abin shigarwa), kuna buƙatar kunna .active
ajin akan shigar da label
kanku.
$().button('toggle')
Canza yanayin turawa. Yana ba da maɓallin kamannin cewa an kunna shi.
$().button('reset')
Yana sake saita yanayin maɓallin - musanya rubutu zuwa rubutu na asali. Wannan hanyar ba ta dace ba kuma tana dawowa kafin a gama sake saiti.
$().button(string)
Yana canza rubutu zuwa kowane yanayin rubutu da aka ayyana.
Filogi mai sassauƙa wanda ke amfani da ɗimbin azuzuwan don sauƙin jujjuya hali.
Rushewa yana buƙatar shigar da plugin ɗin sauyawa a cikin sigar Bootstrap ɗin ku.
Danna maɓallan da ke ƙasa don nunawa da ɓoye wani abu ta canje-canjen aji:
.collapse
boye abun ciki.collapsing
ana amfani dashi a lokacin sauyawa.collapse.in
yana nuna abun cikiKuna iya amfani da hanyar haɗi tare da href
sifa, ko maɓalli tare da data-target
sifa. A cikin duka biyun, data-toggle="collapse"
ana buƙatar.
Ƙarfafa halayen rugujewar tsoho don ƙirƙirar haɗin gwiwa tare da bangaren panel.
Hakanan yana yiwuwa a canza .panel-body
s tare da .list-group
s.
Tabbatar ƙara aria-expanded
zuwa sashin sarrafawa. Wannan sifa tana fayyace ƙayyadaddun yanayin halin yanzu na ɓangaren da zai iya rugujewa zuwa ga masu karanta allo da makamantan fasahar taimako. Idan an rufe kashi mai rugujewa ta tsohuwa, yakamata ya sami darajar aria-expanded="false"
. Idan kun saita abin da zai iya rushewa don buɗewa ta tsohuwa ta amfani da in
ajin, saita aria-expanded="true"
kan sarrafawa maimakon. Plugin zai juya wannan sifa ta atomatik bisa ko an buɗe ko rufe ɓangaren da zai iya rushewa ko a'a.
Bugu da ƙari, idan ɓangaren sarrafa ku yana yin niyya ga wani abu guda ɗaya mai ruɗewa - watau data-target
sifa tana nuni ga mai id
zaɓi - kuna iya ƙara ƙarin aria-controls
sifa zuwa sashin sarrafawa, wanda ya ƙunshi ɓangaren id
da zai iya rushewa. Masu karanta allo na zamani da makamantan fasahar taimako suna amfani da wannan sifa don samarwa masu amfani ƙarin gajerun hanyoyi don kewaya kai tsaye zuwa ɓangaren da zai iya rugujewa kansa.
Fasinjojin rushewa yana amfani da ƴan azuzuwan don ɗaukar nauyi mai nauyi:
.collapse
boye abun ciki.collapse.in
yana nuna abun ciki.collapsing
ana ƙara lokacin da aka fara canji, kuma a cire idan ya ƙareAna iya samun waɗannan azuzuwan a component-animations.less
.
Kawai ƙara data-toggle="collapse"
da data-target
a cikin kashi don ba da ikon sarrafa abin da zai iya rushewa ta atomatik. Siffar data-target
tana karɓar mai zaɓin CSS don amfani da rushewar zuwa. Tabbatar ƙara ajin collapse
zuwa kashi mai rugujewa. Idan kuna son buɗewa ta tsohuwa, ƙara ƙarin ajin in
.
Don ƙara gudanarwar rukuni-kamar accordion zuwa sarrafawa mai yuwuwa, ƙara sifa na bayanai data-parent="#selector"
. Koma zuwa demo don ganin wannan a aikace.
Kunna da hannu tare da:
Za a iya wucewa ta hanyar sifofin bayanai ko JavaScript. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-parent=""
.
Suna | nau'in | tsoho | bayanin |
---|---|---|---|
iyaye | mai zaɓe | karya | Idan an ba da zaɓi, to duk abubuwan da za su iya haɗuwa a ƙarƙashin ƙayyadaddun iyaye za a rufe su lokacin da aka nuna wannan abu mai yuwuwa. (mai kama da dabi'ar haɗin kai na gargajiya - wannan ya dogara da panel aji) |
juya | boolean | gaskiya | Yana kunna abin da zai iya rushewa akan kira |
.collapse(options)
Yana kunna abun cikin ku azaman abin da zai iya rugujewa. Yana yarda da zaɓin zaɓi object
.
.collapse('toggle')
Yana juya wani abu mai rugujewa zuwa nunawa ko ɓoye. Komawa ga mai kira kafin a nuna abin da zai iya rugujewa a zahiri ko a ɓoye (watau kafin abin shown.bs.collapse
ko hidden.bs.collapse
ya faru).
.collapse('show')
Yana nuna kashi mai rugujewa. Komawa ga mai kira kafin a nuna ainihin abin da zai iya rushewa (watau kafin shown.bs.collapse
abin ya faru).
.collapse('hide')
Yana ɓoye wani abu mai rugujewa. Komawa ga mai kira kafin abin da zai iya rushewa ya kasance a ɓoye (watau kafin hidden.bs.collapse
abin ya faru).
Ajin rushewar Bootstrap yana fallasa ƴan abubuwan da suka faru don haɗawa cikin ayyukan rugujewa.
Nau'in Taron | Bayani |
---|---|
nuna.bs.rushewa | Wannan taron yana gobara nan da nan lokacin da show aka kira hanyar misali. |
an nuna.bs.rushewa | Ana korar wannan taron lokacin da aka bayyana ɓangaren rugujewa ga mai amfani (zai jira canjin CSS ya kammala). |
boye.bs.rushe | Ana korar wannan taron nan da nan lokacin da hide aka kira hanyar. |
boye.bs.rushewa | Ana korar wannan taron lokacin da aka ɓoye ɓoyayyiyar ɓarna daga mai amfani (zai jira canjin CSS ya kammala). |
Bangaren nunin faifai don yin keke ta hanyar abubuwa, kamar carousel. Ba a tallafawa carousels masu gida.
Bangaren carousel gabaɗaya baya bin ka'idojin samun dama. Idan kana buƙatar yin biyayya, da fatan za a yi la'akari da wasu zaɓuɓɓuka don gabatar da abun ciki.
Bootstrap yana amfani da CSS3 na musamman don raye-rayensa, amma Internet Explorer 8 & 9 ba sa goyan bayan mahimman kaddarorin CSS. Don haka, babu raye-rayen sauya sheka lokacin amfani da waɗannan masu binciken. Mun yanke shawarar da gangan ba za mu haɗa da koma baya na tushen jQuery don canji ba.
Ana .active
buƙatar ƙara ajin zuwa ɗaya daga cikin nunin faifai. In ba haka ba, carousel ba za a iya gani ba.
Ba lallai ba ne a buƙaci azuzuwan don sarrafawa .glyphicon .glyphicon-chevron-left
. .glyphicon .glyphicon-chevron-right
Bootstrap yana samarwa .icon-prev
kuma .icon-next
azaman madadin unicode bayyananne.
Ƙara taken magana a cikin nunin faifan ku cikin sauƙi tare da abin da .carousel-caption
ke cikin kowane .item
. Sanya kusan kowane HTML na zaɓi a ciki kuma za a daidaita shi ta atomatik kuma a tsara shi.
Carousels na buƙatar amfani da wani id
a kan babban akwati (da .carousel
) don sarrafa carousel don yin aiki da kyau. Lokacin ƙara carousels da yawa, ko lokacin canza carousel's id
, tabbatar da sabunta abubuwan sarrafawa masu dacewa.
Yi amfani da sifofin bayanai don sarrafa matsayin carousel cikin sauƙi. data-slide
yana karɓar kalmomin maɓalli prev
ko next
, wanda ke canza matsayi na faifai dangane da matsayinsa na yanzu. A madadin, yi amfani data-slide-to
da don ƙaddamar da ɗanyen fihirisar zamewa zuwa carousel data-slide-to="2"
, wanda ke canza wurin zamewar zuwa wani fihirisar takamammen farawa da 0
.
Ana data-ride="carousel"
amfani da sifa don yiwa carousel alama azaman mai rai wanda yake farawa daga nauyin shafi. Ba za a iya amfani da shi a hade tare da (m kuma ba dole ba) bayyanannen farawar JavaScript na carousel iri ɗaya.
Kira carousel da hannu tare da:
Za a iya wucewa ta hanyar sifofin bayanai ko JavaScript. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-interval=""
.
Suna | nau'in | tsoho | bayanin |
---|---|---|---|
tazara | lamba | 5000 | Adadin lokacin jinkirta tsakanin yin keke ta atomatik abu. Idan karya, carousel ba zai sake zagayawa ta atomatik ba. |
dakatarwa | zaren | banza | "tsayawa" | Idan an saita zuwa "hover" , dakatar da hawan keke na carousel a kunne mouseenter kuma ya dawo da keken carousel akan mouseleave . Idan an saita zuwa null , shawagi akan carousel ba zai dakata da shi ba. |
kunsa | boolean | gaskiya | Ko carousel ya kamata a ci gaba da zagayawa ko kuma yana da tasha. |
keyboard | boolean | gaskiya | Ko carousel ya kamata ya mayar da martani ga abubuwan da suka faru na madannai. |
.carousel(options)
Ya fara carousel tare da zaɓin zaɓi object
kuma ya fara hawan keke ta abubuwa.
.carousel('cycle')
Zagayawa ta abubuwan carousel daga hagu zuwa dama.
.carousel('pause')
Yana dakatar da carousel daga yin keke ta cikin abubuwa.
.carousel(number)
Yana kewaya carousel zuwa wani firam na musamman (0 tushen, kama da tsararru).
.carousel('prev')
Kewaya zuwa abu na baya.
.carousel('next')
Kewaya zuwa abu na gaba.
Ajin carousel na Bootstrap yana fallasa abubuwa biyu don haɗawa cikin ayyukan carousel.
Duk abubuwan biyu suna da ƙarin kaddarorin masu zuwa:
direction
: Hanyar da carousel ke zamewa (ko dai "left"
ko "right"
).relatedTarget
: Abubuwan DOM da ake zamewa cikin wuri azaman abu mai aiki.Duk abubuwan da suka faru na carousel ana harba su a kan carousel kanta (watau a <div class="carousel">
).
Nau'in Taron | Bayani |
---|---|
slide.bs.carousel | Wannan taron yana gobara nan da nan lokacin da slide aka kira hanyar misali. |
slid.bs.carousel | Ana korar wannan taron lokacin da carousel ya gama sauye-sauyen zamewar sa. |
Affix plugin yana kunna position: fixed;
da kashewa, yana kwaikwayon tasirin da aka samu tare da position: sticky;
. Ƙarƙashin kewayawa a hannun dama shine nunin nunin raye-raye na affix plugin.
Yi amfani da affix plugin ta sifofin bayanai ko da hannu tare da JavaScript naka. A cikin yanayi guda biyu, dole ne ka samar da CSS don matsayi da faɗin abubuwan da aka makala.
Lura: Kar a yi amfani da plugin ɗin affix akan wani abu da ke ƙunshe a cikin wani wuri mai ɗanɗano, kamar ginshiƙin ja ko turawa, saboda bug ɗin ma'anar Safari .
Affix plugin yana juyawa tsakanin aji uku, kowanne yana wakiltar wata jiha: .affix
, .affix-top
, da .affix-bottom
. Dole ne ku samar da salon, ban da position: fixed;
kan .affix
, don waɗannan azuzuwan da kanku (mai zaman kansa na wannan plugin ɗin) don ɗaukar ainihin matsayi.
Ga yadda affix plugin ke aiki:
.affix-top
don nuna kashi yana cikin mafi girman matsayi. A wannan lokacin ba a buƙatar sakawa CSS..affix
maye gurbin .affix-top
da saita position: fixed;
(wanda Bootstrap's CSS ya samar)..affix
da .affix-bottom
. Tunda kashe-kashe na zaɓi ne, saitin ɗaya yana buƙatar ka saita CSS mai dacewa. A wannan yanayin, ƙara position: absolute;
lokacin da ya cancanta. Plugin yana amfani da sifa na bayanai ko zaɓin JavaScript don ƙayyade inda za a sanya kashi daga can.Bi matakan da ke sama don saita CSS ɗin ku don ɗayan zaɓuɓɓukan amfani da ke ƙasa.
Don ƙara ɗabi'ar affix cikin sauƙi zuwa kowane nau'in, kawai ƙara data-spy="affix"
zuwa ɓangaren da kuke son yin leken asiri. Yi amfani da kashewa don ayyana lokacin da za a kunna pinning na wani abu.
Kira plugin ɗin affix ta JavaScript:
Za a iya wucewa ta hanyar sifofin bayanai ko JavaScript. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-offset-top="200"
.
Suna | nau'in | tsoho | bayanin |
---|---|---|---|
biya diyya | lamba | aiki | abu | 10 | Pixels don kashewa daga allo lokacin ƙididdige matsayi na gungurawa. Idan an ba da lamba ɗaya, za a yi amfani da kashewa a cikin kwatance sama da ƙasa. Don samar da na musamman, ƙasa da sama na biya kawai samar da wani abu offset: { top: 10 } ko offset: { top: 10, bottom: 5 } . Yi amfani da aiki lokacin da kake buƙatar ƙididdige ƙididdigewa. |
manufa | mai zabar | kumburi | jQuery element | window abin _ |
Yana ƙayyadadden abin da ake nufi na affix. |
.affix(options)
Yana kunna abun cikin ku azaman abin da aka makala. Yana yarda da zaɓin zaɓi object
.
.affix('checkPosition')
Yana sake ƙididdige yanayin affix dangane da girma, matsayi, da matsayin gungura na abubuwan da suka dace. Ana ƙara .affix
, .affix-top
, da .affix-bottom
azuzuwan zuwa ko cire su daga abubuwan da aka makala bisa ga sabuwar jiha. Ana buƙatar kiran wannan hanyar a duk lokacin da aka canza girman abubuwan da aka maƙala ko kuma abin da ake nufi, don tabbatar da daidaitaccen matsayi na abin da aka makala.
Bootstrap's affix plugin yana fallasa ƴan abubuwan da suka faru don haɗawa cikin ayyukan affix.
Nau'in Taron | Bayani |
---|---|
affix.bs.affix | Wannan taron yana ci gaba nan da nan kafin a saka sinadarin. |
anfafi.bs.affix | Ana korar wannan taron bayan an saka sinadarin. |
affix-top.bs.affix | Wannan taron yana gobara nan da nan kafin a saka kashi a saman. |
maɗaukaki-saman.bs.affix | An kori wannan taron bayan an saka kashi-sama. |
affix-kasa.bs.affix | Wannan taron yana ci gaba nan da nan kafin a saka kashi-kasa. |
manne-kasa.bs.affix | Ana korar wannan taron bayan an maƙala kashi-ƙasa. |