Khawm
Siv Bootstrap cov kev cai khawm style rau kev ua hauv cov ntawv, sib tham, thiab ntau ntxiv nrog kev txhawb nqa rau ntau qhov ntau thiab tsawg, xeev, thiab ntau dua.
Bootstrap suav nrog ntau lub pob khawm ua ntej, txhua tus ua haujlwm rau nws tus kheej lub hom phiaj, nrog ob peb yam ntxiv pov rau hauv kev tswj hwm ntau dua.
Qhia lub ntsiab lus rau kev pab technologies
Siv cov xim los ntxiv cov ntsiab lus tsuas yog muab qhov pom kev pom, uas yuav tsis raug xa mus rau cov neeg siv cov thev naus laus zis pab - xws li cov ntawv nyeem. Xyuas kom meej tias cov ntaub ntawv qhia los ntawm cov xim yog pom tseeb los ntawm cov ntsiab lus nws tus kheej (xws li cov ntawv pom), lossis suav nrog lwm txoj kev, xws li cov ntawv ntxiv zais nrog cov .sr-only
chav kawm.
Cov .btn
chav kawm yog tsim los siv nrog lub <button>
ntsiab. Txawm li cas los xij, koj tuaj yeem siv cov chav kawm no <a>
los yog <input>
cov ntsiab lus (txawm tias qee qhov browsers yuav siv qhov sib txawv me ntsis).
Thaum siv cov chav kawm khawm ntawm <a>
cov ntsiab lus uas tau siv los ua kom muaj kev ua haujlwm hauv nplooj ntawv (xws li kev sib tsoo cov ntsiab lus), tsis yog txuas mus rau nplooj ntawv tshiab lossis ntu hauv nplooj ntawv tam sim no, cov kev sib txuas no yuav tsum tau muab role="button"
rau kom tsim nyog qhia lawv lub hom phiaj rau kev pabcuam thev naus laus zis xws li screen nyeem ntawv.
Xav tau ib lub pob, tab sis tsis yog cov xim tom qab hnyav lawv nqa? Hloov cov chav kawm hloov pauv hloov pauv nrog cov .btn-outline-*
uas yuav tshem tawm tag nrho cov duab tom qab thiab xim ntawm ib lub pob.
Xav tau cov nyees khawm loj lossis me dua? Ntxiv .btn-lg
lossis .btn-sm
rau qhov ntau thiab tsawg.
Tsim thaiv qib nyees khawm-cov uas nthuav dav dav ntawm niam txiv-los ntawm kev ntxiv .btn-block
.
Cov nyees khawm yuav tshwm sim (nrog rau tom qab tsaus nti, ciam teb tsaus nti, thiab teeb duab ntxoov ntxoo) thaum ua haujlwm. Tsis tas yuav ntxiv ib chav rau <button>
s li lawv siv pseudo-chav kawm . Txawm li cas los xij, koj tseem tuaj yeem yuam tib lub ntsej muag nrog .active
(thiab suav nrog tus aria-pressed="true"
cwj pwm) yog tias koj xav tau rov ua dua lub xeev programmatically.
Ua kom cov nyees khawm zoo li tsis ua haujlwm los ntawm kev ntxiv tus disabled
cwj pwm boolean rau txhua <button>
lub caij.
Cov khawm xiam oob qhab siv lub <a>
caij coj txawv me ntsis:
<a>
s tsis txhawb tusdisabled
cwj pwm, yog li koj yuav tsum ntxiv cov.disabled
chav kawm kom nws pom qhov tsis taus.- Qee qhov kev nyiam yav tom ntej yog suav nrog rau lov tes taw tag nrho
pointer-events
ntawm cov nyees khawm thauj tog rau nkoj. Hauv browsers uas txhawb cov cuab yeej ntawd, koj yuav tsis pom tus cursor xiam oob qhab txhua. - Cov nyees khawm xiam oob qhab yuav tsum suav nrog tus
aria-disabled="true"
cwj pwm los qhia txog lub xeev ntawm cov khoom siv rau kev pabcuam.
Link functionality caveat
Cov .disabled
chav kawm siv pointer-events: none
los sim lov tes taw qhov txuas ua haujlwm ntawm <a>
s, tab sis cov cuab yeej CSS tseem tsis tau ua qauv. Tsis tas li ntawd, txawm nyob rau hauv browsers uas txhawb nqa pointer-events: none
, keyboard navigation tseem tsis cuam tshuam, txhais tau hais tias cov neeg siv cov keyboard pom thiab cov neeg siv thev naus laus zis tseem tuaj yeem qhib cov kev txuas no. Yog li kom muaj kev nyab xeeb, ntxiv tus tabindex="-1"
cwj pwm ntawm cov kev sib txuas no (kom tiv thaiv lawv los ntawm kev txais cov keyboard tsom) thiab siv JavaScript kev cai los lov tes taw lawv cov haujlwm.
Ua ntau nrog cov nyees khawm. Tswj khawm hais los yog tsim pab pawg ntawm cov nyees khawm rau ntau yam xws li toolbars.
Ntxiv data-toggle="button"
rau toggle khawm lub active
xeev. Yog hais tias koj nyob nraum pre-toggling ib lub pob, koj yuav tsum manually ntxiv cov .active
chav kawm ntawv thiab aria-pressed="true"
mus rau lub <button>
.
Bootstrap cov .button
qauv tuaj yeem siv rau lwm cov ntsiab lus, xws li <label>
s, los muab lub thawv ntawv lossis lub xov tooj cua style khawm toggling. Ntxiv data-toggle="buttons"
rau qhov .btn-group
uas muaj cov nyees khawm hloov los ua kom lawv tus cwj pwm toggling ntawm JavaScript thiab ntxiv .btn-group-toggle
rau style <input>
s hauv koj cov nyees khawm. Nco ntsoov tias koj tuaj yeem tsim ib qho input-powered nyees khawm lossis pab pawg ntawm lawv.
Lub xeev kuaj rau cov nyees khawm no tsuas yog hloov kho los ntawm click
kev tshwm sim ntawm lub pob. Yog tias koj siv lwm txoj hauv kev los hloov kho cov tswv yim-xws li, nrog <input type="reset">
lossis los ntawm manually siv cov tswv yim cov checked
cuab yeej-koj yuav tsum toggle .active
ntawm <label>
manually.
Nco ntsoov tias cov nyees khawm pre-checked xav kom koj manually ntxiv cov .active
chav kawm rau cov tswv yim <label>
.
Txoj kev | Kev piav qhia |
---|---|
$().button('toggle') |
Toggles thawb lub xeev. Muab lub pob kom pom tias nws tau qhib. |
$().button('dispose') |
Ua kom lub ntsiab lub khawm. |