Alɛrt dɛn
Gi kɔntɛkstual fidbak mɛsej fɔ tipik yuza akshɔn dɛn wit di anful alɛt mɛsej dɛn we de ɛn we kin chenj.
Alɛt dɛn de fɔ ɛni lɔng tɛks, ɛn dɛn gɛt wan bɔtin fɔ dismis we yu kin pik. Fɔ mek yu stayl fayn, yuz wan pan di et kɔntɛkstual klas dɛn we yu nid.alert-success
(ɛgz., ). Fɔ inlayn dismisal, yuz di alɛt dɛn jQuery plɔgin .
<div class="alert alert-primary" role="alert">
This is a primary alert—check it out!
</div>
<div class="alert alert-secondary" role="alert">
This is a secondary alert—check it out!
</div>
<div class="alert alert-success" role="alert">
This is a success alert—check it out!
</div>
<div class="alert alert-danger" role="alert">
This is a danger alert—check it out!
</div>
<div class="alert alert-warning" role="alert">
This is a warning alert—check it out!
</div>
<div class="alert alert-info" role="alert">
This is a info alert—check it out!
</div>
<div class="alert alert-light" role="alert">
This is a light alert—check it out!
</div>
<div class="alert alert-dark" role="alert">
This is a dark alert—check it out!
</div>
Fɔ gi minin to ɛtɛknɔlɔji dɛn we de ɛp
Yuz kala fɔ ad minin de jɔs gi wan vijual indikashɔn, we dɛn nɔ go gi to di wan dɛn we de yuz ɛtɛknɔlɔji dɛn we de ɛp – lɛk skrin rida dɛn. Mek shɔ se di infɔmeshɔn we dɛn sho wit di kɔlɔ de sho klia wan frɔm di tin we de insay insɛf (ɛgz. di tɛks we yu de si), ɔ dɛn put am insay ɔda we dɛn, lɛk ɔda tɛks we dɛn ayd wit di .sr-only
klas.
Yuz di .alert-link
yutiliti klas fɔ gi link dɛn we gɛt kɔlɔ we de mach kwik kwik wan insay ɛni alɛt.
<div class="alert alert-primary" role="alert">
This is a primary alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-secondary" role="alert">
This is a secondary alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-success" role="alert">
This is a success alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-danger" role="alert">
This is a danger alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-warning" role="alert">
This is a warning alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-info" role="alert">
This is a info alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-light" role="alert">
This is a light alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-dark" role="alert">
This is a dark alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
Alɛt dɛn kin gɛt ɔda HTML ɛlimɛnt dɛn bak lɛk ɛd, paregraf ɛn divayda dɛn.
Wɛl dɔn!
Aww yeah, yu saksesfuli rid dis impotant alert mesej. Dis ɛgzampul tɛks go rɔn smɔl lɔng so dat yu go si aw spɛshal insay wan alɛt de wok wit dis kayn kɔntinyu.
Ɛnitɛm we yu nid fɔ du dat, mek shɔ se yu yuz margin utilities fɔ mek tin dɛn fayn ɛn klin.
<div class="alert alert-success" role="alert">
<h4 class="alert-heading">Well done!</h4>
<p>Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.</p>
<hr>
<p class="mb-0">Whenever you need to, be sure to use margin utilities to keep things nice and tidy.</p>
</div>
Yuz di alɛt JavaSkript plɔgin, i pɔsibul fɔ dismis ɛni alɛt inlayn. Na dis na aw fɔ du am:
- Mek shɔ se yu dɔn lod di alɛt plɔgin, ɔ di Bootstrap JavaSkript we dɛn dɔn kɔmpilayt.
- If yu de bil wi JavaSkript frɔm sɔs, i nid fɔ
util.js
. Di wan we dɛn dɔn kɔmpilayt gɛt dis. - Ad wan dismis bɔtin ɛn di
.alert-dismissible
klas, we de ad ɛkstra pad na di rayt say na di alɛt ɛn put di.close
bɔtin. - Na di dismis bɔtin, ad di
data-dismiss="alert"
atribyut, we de mek di JavaSkript wok fayn. Mek shɔ se yu yuz di<button>
ɛlimɛnt wit am fɔ biev fayn akɔdin to ɔl di divays dɛn. - Fɔ mek di alɛt dɛn gɛt layf we yu de dismis dɛn, mek shɔ se yu ad di
.fade
ɛn.show
klas dɛn.
Yu kin si dis in akshɔn wit wan layv dɛmo:
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<strong>Holy guacamole!</strong> You should check in on some of those fields below.
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
Ɛnable fɔ dismis wan alɛt bay JavaSkript:
Ɔ wit data
atribyut dɛn na wan bɔtin insay di alɛt , lɛk aw dɛn sho ɔp:
Notis se we yu lɔk wan alɛt, i go pul am na di DOM.
We | Tɔk bɔt |
---|---|
$().alert() |
Mek wan alɛt lisin fɔ klik ivin dɛn pan disɛndant ɛlimɛnt dɛn we gɛt di data-dismiss="alert" atribyut. (Nɔ nid we yu de yuz di data-api in ɔto-initializashɔn.) |
$().alert('close') |
Klos wan alɛt bay we i pul am na di DOM. If di .fade ɛn .show klas dɛn de na di ɛlimɛnt, di alɛt go dɔn bifo dɛn pul am. |
$().alert('dispose') |
Destroy wan element in alert. |
Bootstrap in alert plɔgin de ɛksplɔz sɔm ivin dɛn fɔ huk insay alert funkshɔnaliti.
Program | Tɔk bɔt |
---|---|
close.bs.alert |
Dis ivent de faya wantɛm wantɛm we dɛn kɔl di close instans mɛtɔd. |
closed.bs.alert |
Dis ivent de faya we di alɛt dɔn lɔk (go wet fɔ CSS transishɔn dɛn fɔ dɔn). |