Alerts
Ipa mamiriro emhinduro mameseji ezviitwa zvemushandisi ane mashoma anowanikwa uye anochinjika echenjedzo meseji.
Mienzaniso
Zviziviso zviripo kune chero hurefu hwemavara, pamwe nebhatani rekusarudzika. Kuti uite manyorerwo akakodzera, shandisa imwe yemakirasi masere anodiwa.alert-success
emamiriro ezvinhu (semuenzaniso, ). Pakudzingwa mukati, shandisa chenjedzo jQuery plugin .
<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>
Kuendesa zvinoreva kunobatsira matekinoroji
Kushandisa ruvara kuwedzera zvinoreva kunongopa chiratidzo chekuona, icho chisingazopirwe kune vashandisi vetekinoroji yekubatsira - senge zvidzitiro zvekuverenga. Ita shuwa kuti ruzivo rwunoratidzwa neruvara rwuri pachena kubva pane zvirimo (semuzvinyorwa zvinooneka), kana kuti zvinosanganisirwa neimwe nzira, senge mamwe mavara akavigwa .sr-only
nekirasi.
Link color
Shandisa .alert-link
utility kirasi kukurumidza kupa anoenderana mavara ekubatanidza mukati meyambiro ipi neipi.
<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>
Zvimwe zvemukati
Yambiro inogona zvakare kuve nekuwedzera HTML zvinhu senge misoro, ndima uye divider.
Kuita zvakanaka!
Aww hongu, iwe wakabudirira kuverenga iyi yakakosha meseji yekuzivisa. Uyu muenzaniso mameseji uchamhanya zvishoma kuitira kuti iwe uone kuti nzvimbo mukati meyambiro inoshanda sei nerudzi urwu rwemukati.
Pese paunoda, iva nechokwadi chekushandisa margin utilities kuchengetedza zvinhu zvakanaka uye zvakatsvinda.
<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>
Kudzinga
Uchishandisa yambiro yeJavaScript plugin, zvinokwanisika kudzinga chero yambiro inline. Heino maitiro:
- Ita shuwa kuti waisa yambiro plugin, kana yakaunganidzwa Bootstrap JavaScript.
- Kana iwe uri kuvaka yedu JavaScript kubva kunobva, zvinoda
util.js
. Iyo yakaunganidzwa vhezheni inosanganisira iyi. - Wedzera bhatani rekudzinga uye
.alert-dismissible
kirasi, iyo inowedzera imwe padding kurudyi rweyambiro uye inoisa.close
bhatani. - Pabhatani rekudzinga, wedzera
data-dismiss="alert"
hunhu, izvo zvinokonzeresa kushanda kweJavaScript. Iva nechokwadi chekushandisa<button>
chinhu nacho kuita zvakanaka pamidziyo yese. - Kuti upe chenjedzo paunenge uchivadzinga, ita chokwadi chekuwedzera
.fade
uye.show
makirasi.
Iwe unogona kuona izvi muchiito neiyo live demo:
<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 maitiro
Zvikonzero
Ita kuti chenjedzo iraswe kuburikidza neJavaScript:
$('.alert').alert()
Kana data
nehunhu pabhatani mukati meyambiro , sezvaratidzwa pamusoro:
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
Ziva kuti kuvhara yambiro kuchaibvisa kubva kuDOM.
Nzira
Nzira | Tsanangudzo |
---|---|
$().alert() |
Inoita yambiro yekuteerera kune zviitiko zvekudzvanya pane zvitubu zvine data-dismiss="alert" hunhu. (Hazvina basa kana uchishandisa iyo data-api's auto-initialization.) |
$().alert('close') |
Inovhara yambiro nekuibvisa muDOM. Kana iyo .fade uye .show makirasi aripo pane chinhu, yambiro inopera isati yabviswa. |
$().alert('dispose') |
Inoparadza chenjedzo yechinhu. |
$('.alert').alert('close')
Zviitiko
Bootstrap's alert plugin inofumura zviitiko zvishoma zvekukochekera mune yambiro mashandiro.
Chiitiko | Tsanangudzo |
---|---|
close.bs.alert |
Ichi chiitiko chinopisa nekukasira kana close nzira yemuenzaniso inodanwa. |
closed.bs.alert |
Ichi chiitiko chinodzingwa kana yambiro yavharwa (ichamirira CSS shanduko kuti ipere). |
$('#myAlert').on('closed.bs.alert', function () {
// do something...
})