Mabatani
Gwiritsani ntchito masitayelo a Bootstrap pamabatani pazochita m'mawonekedwe, zokambirana, ndi zina zambiri mothandizidwa ndi makulidwe angapo, zigawo, ndi zina zambiri.
Zitsanzo
Bootstrap imaphatikizapo masitayelo angapo ofotokozedweratu, iliyonse imagwira ntchito yakeyake, ndi zina zowonjezera zomwe zimaponyedwa kuti ziziwongolera.
Kupereka tanthauzo ku matekinoloje othandizira
Kugwiritsa ntchito utoto kuti muwonjezere tanthauzo kumangopereka chithunzithunzi, chomwe sichidzaperekedwa kwa ogwiritsa ntchito matekinoloje othandizira - monga owerenga pazenera. Onetsetsani kuti zomwe zatchulidwa ndi mtunduwo zikuwonekera kuchokera pazomwe zili (monga zolemba zowonekera), kapena zikuphatikizidwa ndi njira zina, monga zolemba zina zobisika ndi .sr-only
kalasi.
Letsani kukulunga mawu
Ngati simukufuna kuti mawu a batani atseke, mutha kuwonjezera .text-nowrap
kalasi ku batani. Ku Sass, mutha $btn-white-space: nowrap
kuyimitsa kutseka kwa mawu pa batani lililonse.
Ma tag a batani
Maphunzirowa .btn
amapangidwa kuti agwiritsidwe ntchito ndi <button>
element. Komabe, mutha kugwiritsanso ntchito makalasi awa <a>
kapena <input>
zinthu (ngakhale asakatuli ena atha kugwiritsa ntchito kumasulira kosiyana pang'ono).
Mukamagwiritsa ntchito mabatani azinthu <a>
zomwe zimagwiritsidwa ntchito kuyambitsa ntchito zapatsamba (monga kugwa), m'malo molumikizana ndi masamba atsopano kapena magawo omwe ali patsamba lapano, maulalo awa ayenera kuperekedwa role="button"
kuti afotokozere moyenera cholinga chawo kuukadaulo wothandizira monga. owerenga chophimba.
Mabatani owonetsera
Mukufuna batani, koma osati mitundu yayikulu yakumbuyo yomwe amabweretsa? Bwezerani m'malo mwa makalasi osintha .btn-outline-*
kuti muchotse zithunzi zonse zakumbuyo ndi mitundu pa batani lililonse.
Makulidwe
Mukufuna mabatani akulu kapena ang'onoang'ono? Onjezani .btn-lg
kapena .btn-sm
ma size owonjezera.
Pangani mabatani a block level—omwe amatambasula m'lifupi mwa kholo lonse—powonjezera .btn-block
.
Dziko logwira ntchito
Mabatani adzawoneka atapanikizidwa (ndi maziko akuda, malire akuda, ndi mthunzi wamkati) akamagwira ntchito. Palibe chifukwa chowonjezera kalasi ku <button>
s pomwe amagwiritsa ntchito kalasi yabodza . Komabe, mutha kukakamizabe mawonekedwe omwewo .active
(ndikuphatikizanso aria-pressed="true"
) ngati mungafunikire kubwereza boma mwadongosolo.
Dziko olumala
Pangani mabatani kuti awoneke ngati osagwira ntchito powonjezera mawonekedwe a disabled
boolean ku <button>
chinthu chilichonse.
Mabatani olemala omwe amagwiritsa ntchito <a>
chinthucho amachita mosiyana pang'ono:
<a>
s sizigwirizana ndidisabled
chikhalidwecho, chifukwa chake muyenera kuwonjezera.disabled
kalasi kuti iwoneke ngati yolumala.- Masitayelo ena ogwirizana ndi mtsogolo akuphatikizidwa kuti muyimitse zonse pamabatani
pointer-events
a nangula. M'masakatuli omwe amathandizira katunduyo, simudzawona cholozera choyimitsidwa konse. - Mabatani olemala akuyenera kukhala ndi mawonekedwe
aria-disabled="true"
owonetsa momwe zinthu zilili kuukadaulo wothandizira.
Link magwiridwe antchito chenjezo
Kalasiyo .disabled
imagwiritsa ntchito pointer-events: none
kuyesa kuletsa magwiridwe antchito a <a>
s, koma katundu wa CSS sunakhazikitsidwebe. Kuphatikiza apo, ngakhale m'masakatuli omwe amathandizira pointer-events: none
, kuyenda kwa kiyibodi sikukhudzidwa, kutanthauza kuti ogwiritsa ntchito kiyibodi omwe amawona komanso ogwiritsa ntchito matekinoloje othandizira azitha kuyatsa maulalo awa. Chifukwa chake kuti mukhale otetezeka, onjezani zomwe tabindex="-1"
zili pamalumikizidwe awa (kuti muwaletse kuti asalandire chidwi cha kiyibodi) ndikugwiritsa ntchito JavaScript kuti mulepheretse magwiridwe ake.
batani plugin
Chitani zambiri ndi mabatani. Batani lowongolera likunena kapena pangani magulu a mabatani azinthu zambiri ngati zida.
Sinthani maiko
Onjezani data-toggle="button"
kuti musinthe mawonekedwe a batani active
. Ngati musinthiratu batani, muyenera kuwonjezera pamanja .active
kalasi ndi aria-pressed="true"
ku <button>
.
Chongani ndi mabatani wailesi
Masitayilo a Bootstrap .button
atha kugwiritsidwa ntchito pazinthu zina, monga <label>
s, kuti apereke bokosi loyang'ana kapena mabatani a wayilesi. Onjezani data-toggle="buttons"
ku .btn-group
zomwe zili ndi mabatani osinthidwawo kuti athe kusintha machitidwe awo kudzera pa JavaScript ndikuwonjezera .btn-group-toggle
masitayilo omwe <input>
ali mkati mwa mabatani anu. Zindikirani kuti mutha kupanga mabatani olowetsa mphamvu imodzi kapena magulu awo.
Mawonekedwe osankhidwa a mabataniwa amangosinthidwa ndi chochitika click
chomwe chili pa batani. Ngati mugwiritsa ntchito njira ina yosinthira zomwe mwalowetsamo, mwachitsanzo, pogwiritsa <input type="reset">
ntchito kapena kugwiritsa ntchito pamanja zomwe checked
mwalowetsamo, muyenera kusintha .active
pamanja <label>
.
Zindikirani kuti mabatani omwe adasankhidwa kale amafuna kuti muwonjezere .active
kalasi pa zolowetsa <label>
.
Njira
Njira | Kufotokozera |
---|---|
$().button('toggle') |
Imatembenuza dziko lokankhira. Imawonetsa batani kuwonekera kuti yayatsidwa. |
$().button('dispose') |
Iwononga batani la chinthu. |