SourceIzexwayiso
Nikeza imilayezo yempendulo yomongo yezenzo zabasebenzisi ezijwayelekile ngedlanzana lemilayezo etholakalayo neguquguqukayo yesexwayiso.
Izaziso ziyatholakala kunoma ibuphi ubude bombhalo, kanye nenkinobho yokuchitha ngokuzithandela. Ukuze wenze isitayela esifanele, sebenzisa izigaba eziyisishiyagalombili ezidingekayo zesimo (isb, .alert-success
). Ngokukhipha okusemgqeni, sebenzisa i- plugin yezaziso ze-jQuery .
Isexwayiso esibalulekile esilula—sihlole!
Isexwayiso sesibili esilula—sihlole!
Isexwayiso esilula sempumelelo—sihlole!
Isexwayiso esilula sengozi—sihlole!
Isexwayiso esilula—sihlole!
Isexwayiso esilula solwazi—sihlole!
Isexwayiso esilula sokukhanya—sihlole!
Isexwayiso esilula esimnyama—sihlole!
Ukudlulisa incazelo kubuchwepheshe obusizayo
Ukusebenzisa umbala ukwengeza incazelo kunikeza kuphela inkomba ebonakalayo, engeke idluliselwe kubasebenzisi bobuchwepheshe obusizayo - njengezifundi zesikrini. Qinisekisa ukuthi ulwazi olushiwo umbala lusobala kokuqukethwe ngokwako (isb umbhalo obonakalayo), noma lufakwe ngezinye izindlela, njengombhalo owengeziwe ofihliwe .sr-only
nekilasi.
Sebenzisa .alert-link
isigaba sosizo ukuze unikeze ngokushesha izixhumanisi ezinemibala efanayo ngaphakathi kwanoma yisiphi isexwayiso.
Isexwayiso esiyisisekelo esilula esinesixhumanisi
esiyisibonelo . Ichofoze uma uthanda.
Isexwayiso sesibili esilula esinesixhumanisi
esiyisibonelo . Ichofoze uma uthanda.
Isexwayiso esilula sempumelelo esinesixhumanisi
esiyisibonelo . Ichofoze uma uthanda.
Isexwayiso esilula sengozi esinesixhumanisi
esiyisibonelo . Ichofoze uma uthanda.
Isexwayiso esilula esinesixhumanisi
esiyisibonelo . Ichofoze uma uthanda.
Isexwayiso esilula solwazi esinesixhumanisi
esiyisibonelo . Ichofoze uma uthanda.
Isexwayiso esilula esinesixhumanisi
esiyisibonelo . Ichofoze uma uthanda.
Isexwayiso esimnyama esilula esinesixhumanisi
esiyisibonelo . Ichofoze uma uthanda.
Izaziso zingaqukatha izici ezengeziwe ze-HTML njengezihloko, izigaba kanye nabahlukanisi.
Wenze kahle!
Aww yeah, ufunde ngempumelelo lo mlayezo obalulekile wesexwayiso. Lo mbhalo oyisibonelo uzosebenza isikhathi eside ukuze ukwazi ukubona ukuthi isikhala phakathi kwesexwayiso sisebenza kanjani nalolu hlobo lokuqukethwe.
Noma nini lapho udinga, qiniseka ukuthi usebenzisa izinsiza ze-margin ukuze ugcine izinto zizinhle futhi zicocekile.
Ngokusebenzisa i-plugin yesixwayiso se-JavaScript, kungenzeka ukucashisa noma yisiphi isexwayiso esisemgqeni. Nansi indlela:
- Qiniseka ukuthi ulayishe i-plugin yesixwayiso, noma i-Bootstrap JavaScript ehlanganisiwe.
- Uma wakha i-JavaScript yethu ngomthombo, idinga
util.js
. Inguqulo ehlanganisiwe ihlanganisa lokhu.
- Engeza inkinobho yokucashisa kanye
.alert-dismissible
neklasi, okwengeza i-padding eyengeziwe kwesokudla sesexwayiso futhi imise .close
inkinobho.
- Enkinobho yokucashisa, engeza
data-dismiss="alert"
isibaluli, esicupha ukusebenza kwe-JavaScript. Qiniseka ukuthi usebenzisa i- <button>
elementi nayo ngokuziphatha okufanele kuwo wonke amadivayisi.
- Ukuze wenze izexwayiso zigqwayize uma uzichitha, qiniseka ukuthi ungeza
.fade
kanye .show
namakilasi.
Lokhu ungakubona ngesenzo ngedemo ebukhoma:
I-guacamole engcwele! Kufanele ungene kwezinye zalezo zinkambu ngezansi.
Ukuziphatha kweJavaScript
Nika amandla ukuchithwa kwesexwayiso nge-JavaScript:
Noma ngezibaluli data
enkinobheni engaphakathi kwesexwayiso , njengoba kubonisiwe ngenhla:
Qaphela ukuthi ukuvala isexwayiso kuzosisusa ku-DOM.
Indlela |
Incazelo |
$().alert() |
Yenza isixwayiso silalele imicimbi yokuchofoza ezintweni eziphumayo data-dismiss="alert" ezinesibaluli. (Akudingekile uma usebenzisa i-auto-initialization ye-data-api.) |
$().alert('close') |
Ivala isexwayiso ngokusisusa ku-DOM. Uma i- .fade kanye .show namakilasi ekhona engxenyeni, isexwayiso sizofiphala ngaphambi kokuthi sisuswe. |
$().alert('dispose') |
Icekela phansi isixwayiso se-elementi. |
I-plugin yesixwayiso ye-Bootstrap iveza imicimbi embalwa ukuze ixhumeke ekusebenzeni kwesixwayiso.
Umcimbi |
Incazelo |
close.bs.alert |
Lo mcimbi uvutha ngokushesha lapho close indlela yesibonelo ibizwa. |
closed.bs.alert |
Lo mcimbi uyaxoshwa uma isaziso sivaliwe (sizolinda ukuthi izinguquko ze-CSS ziqedele). |