Mabhatani
Shandisa Bootstrap's tsika bhatani masitaera ezviito mumafomu, dialog, uye nezvimwe nerutsigiro rwehukuru hwakawanda, nyika, nezvimwe.
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.
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.
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.
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
.
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.
Ita kuti mabhatani ataridzike asingashande nekuwedzera 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 akaremara 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.
Ita zvakawanda nemabhatani. Kudzora bhatani rinotaura kana kugadzira mapoka emabhatani ezvimwe zvinhu zvakaita sematurusi.
Wedzera data-toggle="button"
kusandura mamiriro ebhatani active
. Kana uri kufanobatidza bhatani, unofanira kuwedzera .active
kirasi nemaoko aria-pressed="true"
kune <button>
.
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 | Tsanangudzo |
---|---|
$().button('toggle') |
Toggles push state. Inopa bhatani kutaridzika kuti rakaitwa. |
$().button('dispose') |
Kuparadza bhatani rechimwe chinhu. |