Sourceceeb toom
Muab cov ntsiab lus tawm tswv yim tawm tswv yim rau cov neeg siv ib txwm ua nrog cov lus ceeb toom muaj thiab hloov pauv tau.
Piv txwv
Cov ntawv ceeb toom muaj nyob rau txhua qhov ntev ntawm cov ntawv nyeem, nrog rau qhov xaiv tso tseg khawm. Rau styling kom tsim nyog, siv ib qho ntawm yim yam uas yuav tsum tau muaj cov chav kawm (piv txwv li, .alert-success
). Rau inline tshem tawm, siv cov lus ceeb toom jQuery plugin .
Ib qho yooj yim tshaj ceeb toom - xyuas nws!
Ib qho yooj yim thib ob ceeb toom - xyuas nws!
Kev ceeb toom ua tiav yooj yim - xyuas nws!
Ib qho kev ceeb toom txaus ntshai yooj yim - xyuas nws!
Ib qho yooj yim ceeb toom ceeb toom - xyuas nws!
Kev ceeb toom cov ntaub ntawv yooj yim - xyuas nws!
Lub teeb ceeb toom yooj yim - xyuas nws!
Kev ceeb toom tsaus nti yooj yim - xyuas nws!
Luam
<div class= "alert alert-primary" role= "alert" >
A simple primary alert—check it out!
</div>
<div class= "alert alert-secondary" role= "alert" >
A simple secondary alert—check it out!
</div>
<div class= "alert alert-success" role= "alert" >
A simple success alert—check it out!
</div>
<div class= "alert alert-danger" role= "alert" >
A simple danger alert—check it out!
</div>
<div class= "alert alert-warning" role= "alert" >
A simple warning alert—check it out!
</div>
<div class= "alert alert-info" role= "alert" >
A simple info alert—check it out!
</div>
<div class= "alert alert-light" role= "alert" >
A simple light alert—check it out!
</div>
<div class= "alert alert-dark" role= "alert" >
A simple dark alert—check it out!
</div>
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.
Txuas xim
Siv cov .alert-link
chav kawm siv hluav taws xob kom sai muab cov xim sib xws hauv ib qho kev ceeb toom.
Ib qho yooj yim thawj ceeb toom nrog
piv txwv txuas . Muab nws nias yog tias koj nyiam.
Ib qho yooj yim thib ob ceeb toom nrog
piv txwv txuas . Muab nws nias yog tias koj nyiam.
Kev ceeb toom ua tiav yooj yim nrog
piv txwv txuas . Muab nws nias yog tias koj nyiam.
Kev ceeb toom yooj yim txaus ntshai nrog
piv txwv txuas . Muab nws nias yog tias koj nyiam.
Ib qho yooj yim ceeb toom ceeb toom nrog
piv txwv txuas . Muab nws nias yog tias koj nyiam.
Ib qho yooj yim cov ntaub ntawv ceeb toom nrog
piv txwv txuas . Muab nws nias yog tias koj nyiam.
Ib qho yooj yim teeb ceeb toom nrog
piv txwv txuas . Muab nws nias yog tias koj nyiam.
Ib qho yooj yim tsaus ntuj ceeb toom nrog
piv txwv txuas . Muab nws nias yog tias koj nyiam.
Luam
<div class= "alert alert-primary" role= "alert" >
A simple 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" >
A simple 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" >
A simple 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" >
A simple 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" >
A simple 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" >
A simple 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" >
A simple 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" >
A simple dark alert with <a href= "#" class= "alert-link" > an example link</a> . Give it a click if you like.
</div>
Cov ntsiab lus ntxiv
Cov lus ceeb toom tuaj yeem muaj cov ntsiab lus HTML ntxiv xws li kab lus, kab lus thiab cov kab sib faib.
Ua tau zoo!
Aw yeah, koj tau nyeem cov lus ceeb toom tseem ceeb no. Cov ntawv nyeem piv txwv no yuav khiav ntev me ntsis kom koj tuaj yeem pom qhov sib nrug li cas hauv kev ceeb toom ua haujlwm nrog cov ntsiab lus zoo li no.
Thaum twg koj xav tau, nco ntsoov siv cov khoom siv hluav taws xob kom zoo thiab huv si.
Luam
<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>
Tso tseg
Siv lub ceeb toom JavaScript plugin, nws muaj peev xwm tso tseg ib qho kev ceeb toom hauv kab. Nov yog li cas:
Nco ntsoov tias koj tau thauj khoom ceeb toom plugin, lossis suav nrog Bootstrap JavaScript.
Yog tias koj tab tom tsim peb JavaScript los ntawm qhov chaw, nws xav tauutil.js
. Lub compiled version muaj xws li qhov no.
Ntxiv lub khawm tshem tawm thiab .alert-dismissible
chav kawm, uas ntxiv padding ntxiv rau sab xis ntawm kev ceeb toom thiab tso lub .close
pob.
Ntawm lub pob tshem tawm, ntxiv tus data-dismiss="alert"
cwj pwm, uas ua rau JavaScript ua haujlwm. Nco ntsoov siv lub <button>
caij nrog nws rau kev coj tus cwj pwm zoo thoob plaws txhua yam khoom siv.
Txhawm rau ua kom muaj kev ceeb toom thaum tso tawm lawv, nco ntsoov ntxiv cov chav kawm .fade
thiab .show
cov chav kawm.
Koj tuaj yeem pom qhov no hauv kev nqis tes ua nrog qhov demo nyob:
Dawb huv guacamole! Koj yuav tsum tshawb xyuas hauv qee qhov ntawm cov teb hauv qab no.
×
Luam
<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>
JavaScript cwj pwm
Ua rau
Pab kom tshem tawm kev ceeb toom ntawm JavaScript:
Luam
$ ( '.alert' ). alert ()
Los yog nrog cov data
cwj pwm ntawm ib lub pob hauv qhov kev ceeb toom , raws li tau qhia saum toj no:
Luam
<button type= "button" class= "close" data-dismiss= "alert" aria-label= "Close" >
<span aria-hidden= "true" > × </span>
</button>
Nco ntsoov tias kaw qhov kev ceeb toom yuav tshem tawm ntawm DOM.
Cov txheej txheem
Txoj kev
Kev piav qhia
$().alert()
Ua kom ceeb toom mloog rau cov xwm txheej nyem ntawm cov xeeb leej xeeb ntxwv uas muaj tus data-dismiss="alert"
cwj pwm. (Tsis tsim nyog thaum siv data-api's auto-initialization.)
$().alert('close')
Kaw ib qho kev ceeb toom los ntawm kev tshem tawm ntawm DOM. Yog hais tias cov .fade
thiab .show
cov chav kawm muaj nyob rau ntawm lub caij, lub ceeb toom yuav ploj mus ua ntej nws yuav raug tshem tawm.
$().alert('dispose')
Ua kom puas lub ntsiab lus ceeb toom.
Luam
$ ( ".alert" ). alert ( 'close' )
Cov xwm txheej
Bootstrap's alert plugin nthuav tawm ob peb txheej xwm rau hooking rau hauv kev ceeb toom ua haujlwm.
Kev tshwm sim
Kev piav qhia
close.bs.alert
Qhov xwm txheej no tua hluav taws tam sim ntawd thaum close
hu ua piv txwv.
closed.bs.alert
Qhov kev tshwm sim no raug rho tawm haujlwm thaum lub ceeb toom tau raug kaw (yuav tos rau CSS kev hloov pauv kom tiav).
Luam
$ ( '#myAlert' ). on ( 'closed.bs.alert' , function () {
// do something…
})