Fa nsɛm a ɛfa ho nsɛm a wɔde ma ho nkrasɛm ma nneyɛe a ɛtaa ba a ɔde di dwuma no de nsa kakraa bi a ɛwɔ hɔ na ɛyɛ mmerɛw a wɔde bɔ kɔkɔ no ma.
Nhwɛso ahorow
Wɔabɔ kɔkɔ wɔ nsɛm a wɔakyerɛw no tenten biara ho, ne bɔtn a wubetumi apaw a ɛbɛma woagyae adwuma no. Sɛ wopɛ sɛ wohyɛ no yiye a, fa nsɛm a ɛfa ho adesua ahorow awotwe a wɔhwehwɛ no mu biako di dwuma (sɛ nhwɛso no, .alert-success). Sɛ wopɛ sɛ woyi obi fi mu a, fa kɔkɔbɔ ahorow jQuery plugin no di dwuma .
Kɔkɔbɔ titiriw a ɛnyɛ den—hwɛ mu!
Kɔkɔbɔ a ɛto so abien a ɛnyɛ den—hwɛ mu!
Osi yiye ho kɔkɔbɔ a ɛnyɛ den—hwɛ!
Asiane ho kɔkɔbɔ a ɛnyɛ den—hwɛ mu!
Kɔkɔbɔ kɔkɔbɔ a ɛnyɛ den—hwɛ mu!
Info kɔkɔbɔ a ɛnyɛ den—hwɛ!
Hann kɔkɔbɔ a ɛnyɛ den—hwɛ mu!
Esum mu kɔkɔbɔ a ɛnyɛ den—hwɛ!
Ntease a wɔde bɛma mfiridwuma ahorow a ɛboa
Kɔla a wɔde di dwuma de ntease ka ho no ma wonya sɛnkyerɛnne a wotumi hu nkutoo, a wɔremfa nkɔma wɔn a wɔde mfiridwuma a ɛboa di dwuma – te sɛ screen akenkanfo. Hwɛ sɛ nsɛm a wɔde kɔla no kyerɛ no da adi pefee fi emu nsɛm no ankasa mu (sɛ nhwɛso no, nsɛm a wotumi hu no), anaasɛ wɔde bɛka ho denam akwan foforo so, te sɛ nsɛm foforo a wɔde asie ne .sr-onlyadesuakuw no mu.
Link kɔla
Fa .alert-linkutility class no di dwuma fa ntɛm ara ma links a ɛwɔ kɔla a ɛne no hyia wɔ kɔkɔbɔ biara mu.
Mfitiase kɔkɔbɔ a ɛnyɛ den a
ɛwɔ nhwɛso link . Ma no click sɛ wopɛ a.
Kɔkɔbɔ a ɛto so abien a ɛnyɛ den a
ɛwɔ nhwɛso link . Ma no click sɛ wopɛ a.
A simple success alert a
ɛwɔ nhwɛso link . Ma no click sɛ wopɛ a.
Asiane ho kɔkɔbɔ a ɛnyɛ den a
ɛwɔ nhwɛso link . Ma no click sɛ wopɛ a.
Kɔkɔbɔ kɔkɔbɔ a ɛnyɛ den a
ɛwɔ nhwɛso link . Ma no click sɛ wopɛ a.
Info kɔkɔbɔ a ɛnyɛ den a
ɛwɔ nhwɛso link . Ma no click sɛ wopɛ a.
Hann kɔkɔbɔ a ɛnyɛ den a
ɛwɔ nhwɛso link . Ma no click sɛ wopɛ a.
Esum kɔkɔbɔ a ɛnyɛ den a
ɛwɔ nhwɛso link . Ma no click sɛ wopɛ a.
Nsɛm foforo a ɛwɔ mu
Kɔkɔbɔ nso betumi akura HTML nneɛma foforo te sɛ nsɛmti, nkyekyɛm ne nkyekyɛmu.
Woayɛ adeɛ!
Aww yeah, woakenkan saa kɔkɔbɔ nkrasɛm a ɛho hia yi yiye. Saa nhwɛsoɔ nkyerɛwee yi rekɔ so akyɛ kakra sɛdeɛ ɛbɛyɛ a wobɛtumi ahunu sɛdeɛ ntam kwan a ɛwɔ kɔkɔbɔ bi mu no yɛ adwuma wɔ saa nsɛm yi ho.
Bere biara a ɛho behia no, hwɛ hu sɛ wode margin utilities bedi dwuma na ama nneɛma ayɛ fɛ na ayɛ pɛpɛɛpɛ.
Wobeyi wɔn afi adwumam
Sɛ wode kɔkɔbɔ JavaScript plugin no di dwuma a, wubetumi apow kɔkɔbɔ biara a ɛwɔ inline no mu. Sɛnea ɛte ni:
Hwɛ sɛ woahyɛ kɔkɔbɔ plugin no, anaa Bootstrap JavaScript a wɔaboaboa ano no.
Sɛ worekyekye yɛn JavaScript no afi fibea a, ɛhwehwɛ sɛutil.js . Nea ɛka nkyerɛase a wɔaboaboa ano no ho ne eyi.
Fa dismiss button ne .alert-dismissibleclass no ka ho, na ɛde padding foforo ka ho wɔ kɔkɔbɔ no nifa so na ɛde .closebutton no si hɔ.
Wɔ dismiss button no so no, fa data-dismiss="alert"attribute no ka ho, na ɛkanyan JavaScript dwumadie no. Hwɛ hu sɛ wode <button>element no bedi dwuma ne no ama suban pa wɔ mfiri ahorow nyinaa so.
Sɛnea ɛbɛyɛ a wobɛma kɔkɔbɔ ahorow no ayɛ anigye bere a worepam no no, hwɛ hu sɛ wode .fadene .showadesua ahorow no bɛka ho.
Wubetumi ahu eyi wɔ adeyɛ mu denam live demo so:
Guacamole kronkron! Ɛsɛ sɛ wohwɛ saa nsɛm a ɛwɔ ase hɔ no bi mu.
JavaScript nneyɛe
Nneɛma a ɛkanyan adwene
Ma kɔkɔbɔ bi a wɔpow no nyɛ adwuma denam JavaScript so:
Anaasɛ datasu ahorow a ɛwɔ bɔtn bi so wɔ kɔkɔbɔ no mu , sɛnea wɔada no adi wɔ atifi hɔ no:
Hyɛ no nsow sɛ sɛ woto kɔkɔbɔ bi mu a, ebeyi afi DOM no mu.
Akwan a wɔfa so yɛ
Ɔkwan
Nkyerɛmu
$().alert()
Ɛma kɔkɔbɔ tie click nsɛm a esisi wɔ aseni elements a ɛwɔ data-dismiss="alert"attribute no so. (Ɛho nhia bere a wode data-api no auto-initialization redi dwuma no.)
$().alert('close')
Ɛto kɔkɔbɔ bi mu denam yi a wubeyi afi DOM no mu no so. Sɛ .fadene .showadesua ahorow no wɔ element no so a, kɔkɔbɔ no bɛyera ansa na wɔayi afi hɔ.
$().alert('dispose')
Ɔsɛe element bi ani a ɛwɔ hɔ no.
Nsɛm a esisi
Bootstrap no kɔkɔbɔ plugin no da nsɛm kakraa bi a esisi ma hooking kɔ kɔkɔbɔ dwumadi mu adi.
Dwumadie
Nkyerɛmu
close.bs.alert
Saa adeyɛ yi tow ntɛm ara bere a closewɔfrɛ instance kwan no.
closed.bs.alert
Wɔtow saa adeyɛ yi bere a wɔato kɔkɔbɔ no mu (bɛtwɛn ma CSS nsakrae ahorow no awie).