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.
Ɛgzampul dɛn
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 .
Wan simpul praymari alɛt—chɛk am!
Wan simpul sɛkɔndari alɛt—chɛk am!
Wan simpul sakrifays alert—chɛk am!
Wan simpul denja alert—chɛk am!
Wan simpul wɔnin alert—chɛk am!
Wan simpul info alɛt—chɛk am!
Wan simpul layt alɛt—chɛk am!
Wan simpul dak alɛt—chɛk am!
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-onlyklas.
Link kɔlɔ
Yuz di .alert-linkyutiliti klas fɔ gi link dɛn we gɛt kɔlɔ we de mach kwik kwik wan insay ɛni alɛt.
Wan simpul praymari alɛt wit
ɛgzampul link . Gi am wan klik if yu lɛk.
Wan simpul sɛkɔndari alɛt wit
ɛgzampul link . Gi am wan klik if yu lɛk.
Wan simpul sakses alert wit
wan ɛgzampul link . Gi am wan klik if yu lɛk.
Wan simpul denja alɛt wit
ɛgzampul link . Gi am wan klik if yu lɛk.
Wan simpul wɔnin alɛt wit
ɛgzampul link . Gi am wan klik if yu lɛk.
Wan simpul info alɛt wit
wan ɛgzampul link . Gi am wan klik if yu lɛk.
Wan simpul layt alɛt wit
wan ɛgzampul link . Gi am wan klik if yu lɛk.
Wan simpul dak alɛt wit
wan ɛgzampul link . Gi am wan klik if yu lɛk.
Ɔda tin dɛn we de insay de
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.
Fɔ dismis
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-dismissibleklas, we de ad ɛkstra pad na di rayt say na di alɛt ɛn put di .closebɔ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 .showklas dɛn.
Yu kin si dis in akshɔn wit wan layv dɛmo:
Oli guacamole! Yu fɔ chɛk insay sɔm pan dɛn fil dɛn de we de dɔŋ ya.
JavaSkript bihayvya
Di tin dɛn we de mek pɔsin want fɔ du sɔntin
Ɛnable fɔ dismis wan alɛt bay JavaSkript:
Ɔ wit dataatribyut 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.
Di we aw dɛn de du am
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 .showklas 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.
Di tin dɛn we kin apin
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 closeinstans 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).