Mabhatani
Shandisa Bootstrap's tsika bhatani masitaera ezviito mumafomu, dialog, uye nezvimwe nerutsigiro rwehukuru hwakawanda, nyika, nezvimwe.
Mienzaniso
Bootstrap inosanganisira akati wandei akafanotsanangurwa mabhatani masitaera, imwe neimwe ichishandira yayo semantic chinangwa, iine mashoma ekuwedzera akakandwa mukati kuti awedzere kutonga.
Kuendesa zvinoreva kunobatsira matekinoroji
Kushandisa ruvara kuwedzera zvinoreva kunongopa chiratidzo chekuona, icho chisingazopirwe kune vashandisi vetekinoroji yekubatsira - senge zvidzitiro zvekuverenga. Ita shuwa kuti ruzivo rwunoratidzwa neruvara rwuri pachena kubva pane zvirimo (semuzvinyorwa zvinooneka), kana kuti zvinosanganisirwa neimwe nzira, senge mamwe mavara akavigwa .sr-only
nekirasi.
Dzima kupeta zvinyorwa
Kana iwe usingade kuti bhatani riputirwe, unogona kuwedzera .text-nowrap
kirasi kubhatani. MuSass, unogona $btn-white-space: nowrap
kuseta kudzima kupeta mameseji kwebhatani rega rega.
Button tags
Makirasi .btn
akagadzirirwa kushandiswa <button>
nechinhu. Nekudaro, iwe unogona zvakare kushandisa aya makirasi pane <a>
kana <input>
zvinhu (kunyangwe mamwe mabhurawuza anogona kushandisa akati siyanei kupa).
Paunenge uchishandisa mabhatani makirasi pane <a>
zvinhu zvinoshandiswa kukonzeresa mukati-peji kushanda (sekudonha zvemukati), pane kubatanidza kune mapeji matsva kana zvikamu mukati peji razvino, izvi zvinongedzo zvinofanirwa kupihwa role="button"
kuti vaendese chinangwa chavo nenzira kwayo kune tekinoroji inobatsira senge. vanoverenga skrini.
Mabhatani erondedzero
Mukuda bhatani, asi kwete iwo hefty kumashure mavara avanounza? Tsiva makirasi ekugadzirisa makirasi neayo .btn-outline-*
kuti ubvise mifananidzo yese yekumashure uye mavara pane chero bhatani.
Saizi
Unoda mabhatani makuru kana madiki? Wedzera .btn-lg
kana .btn-sm
kuwedzera saizi.
Gadzira mabhatani e block level — ayo anotambanudzira upamhi hwakazara hwemubereki — nekuwedzera .btn-block
.
Active state
Mabhatani anozoonekwa akadzvanywa (aine yakasviba kumashure, yakasviba muganho, uye inset mumvuri) kana ichishanda. Hapana chikonzero chekuwedzera kirasi kune <button>
s sezvavanoshandisa pseudo-kirasi . Nekudaro, iwe unogona kuramba uchimanikidza chitarisiko chimwechete chinoshanda ne .active
(uye sanganisira aria-pressed="true"
hunhu) kana iwe uchinge uchinge uchinge uchinge uchinge uchinge uchinge uchinge uchinge uchinge uchinge uchinge uchinge uchingedzera nyika.
Disabled state
Ita kuti mabhatani ataridzike asingashande nekuwedzera iyo disabled
boolean hunhu kune chero <button>
chinhu.
Mabhatani akaremara achishandisa <a>
chinhu anoita zvakati siyanei:
<a>
s haitsigiredisabled
hunhu, saka unofanirwa kuwedzera.disabled
kirasi kuti iite seyakaremara.- Mamwe masitaera ane hushamwari anosanganisirwa kudzima zvese
pointer-events
pamabhatani eanchor. Mumabhurawuza anotsigira chivakwa ichocho, hauzooni yakaremara cursor zvachose. - Mabhatani akaremara anofanirwa kusanganisira
aria-disabled="true"
hunhu kuratidza mamiriro echinhu kune zvinobatsira tekinoroji.
Link functionality caveat
Kirasi .disabled
inoshandisa pointer-events: none
kuyedza kudzima iyo link inoshanda ye <a>
s, asi iyo CSS pfuma haisati yamira. Pamusoro pezvo, kunyangwe mumabhurawuza anotsigira pointer-events: none
, keyboard navigation inoramba isina kukanganiswa, zvichireva kuti vanoona vashandisi vekhibhodi nevashandisi veanobatsira matekinoroji vachiri kukwanisa kumisa aya malink. Saka kuti uve wakachengeteka, wedzera tabindex="-1"
hunhu pane izvi zvinongedzo (kuvadzivirira kubva pakugashira keyboard) uye shandisa tsika JavaScript kudzima mashandiro avo.
Bhatani plugin
Ita zvakawanda nemabhatani. Kudzora bhatani rinotaura kana kugadzira mapoka emabhatani ezvimwe zvinhu zvakaita sematurusi.
Toggle states
Wedzera data-toggle="button"
kusandura mamiriro ebhatani active
. Kana uri kufanobatidza bhatani, unofanira kuwedzera .active
kirasi nemaoko aria-pressed="true"
kune <button>
.
Checkbox nemabhatani eredhiyo
Zvitaera zveBootstrap .button
zvinogona kuiswa kune zvimwe zvinhu, senge <label>
s, kupa bhokisi rekutarisa kana redhiyo bhatani redhiyo. Wedzera data-toggle="buttons"
kune .btn-group
ine iwo mabhatani akagadziridzwa kuti agonese maitiro avo ekuchinja kuburikidza neJavaScript uye wedzera .btn-group-toggle
kustaira <input>
s mukati mabhatani ako. Ziva kuti unogona kugadzira mabhatani ekuisa-ane simba rimwe chete kana mapoka awo.
Iyo yakatariswa mamiriro emabhatani aya inongogadziridzwa kuburikidza click
nechiitiko pabhatani. Kana iwe ukashandisa imwe nzira kugadzirisa zvinopinza - semuenzaniso, <input type="reset">
nekuisa kana nemaoko nekuisa checked
midziyo - unozofanirwa kuchinjika .active
pamaoko <label>
.
Ziva kuti mabhatani afanochekwa anoda kuti iwe uwedzere .active
kirasi kune yekupinda <label>
.
Nzira
Nzira | Tsanangudzo |
---|---|
$().button('toggle') |
Toggles push state. Inopa bhatani kutaridzika kuti rakaitwa. |
$().button('dispose') |
Kuparadza bhatani rechimwe chinhu. |