Imenyesha
Tanga ibitekerezo byubutumwa bwibikorwa kubikorwa bisanzwe byabakoresha hamwe nubutumwa buboneka kandi bworoshye bwo kumenyesha.
Imenyesha riraboneka kuburebure bwinyandiko, kimwe nubushake bwo kwirukana. Kuburyo bukwiye, koresha kimwe mubyiciro umunani bisabwa.alert-success
(urugero, ). Kubirukana kumurongo, koresha imenyesha jQuery plugin .
<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>
Gutanga ibisobanuro kubuhanga bufasha
Gukoresha ibara kugirango wongere ibisobanuro bitanga gusa icyerekezo cyerekana, kitazashyikirizwa abakoresha tekinoroji ifasha - nk'abasoma ecran. Menya neza ko amakuru yerekanwe n'ibara agaragara uhereye kubirimo ubwabyo (urugero: inyandiko igaragara), cyangwa bigashyirwa muburyo butandukanye, nk'inyandiko y'inyongera ihishe hamwe .sr-only
n'ishuri.
Koresha urwego .alert-link
rwingirakamaro kugirango utange byihuse guhuza amabara muburyo ubwo aribwo bwose.
<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>
Imenyesha rishobora kandi kubamo HTML yinyongera nkimitwe, paragarafu nabatandukanya.
Muraho neza!
Aww yego, wasomye neza ubu butumwa bwingenzi bwo kumenyesha. Uru rugero rwinyandiko rugiye gukora birebire kugirango ubone uko intera iri mumenyesha ikorana nubwoko bwibirimo.
Igihe cyose ubikeneye, menya neza gukoresha margin utanga ibintu kugirango ibintu bishoboke.
<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>
Ukoresheje plugin ya JavaScript imenyesha, birashoboka gusezerera umurongo uwo ari wo wose. Dore uko:
- Menya neza ko wapakiye plugin yo kumenyesha, cyangwa icyegeranyo cya Bootstrap JavaScript.
- Niba wubaka JavaScript yacu kuva isoko, birasaba
util.js
. Inyandiko yakozwe ikubiyemo ibi. - Ongeraho buto yo kwirukana hamwe
.alert-dismissible
nishuri, byongeramo padi iburyo bwiburyo bwo kumenyesha no gushyira.close
buto. - Kuri buto yo kwirukana, ongeramo
data-dismiss="alert"
ikiranga, gikurura imikorere ya JavaScript. Witondere gukoresha<button>
element hamwe nayo kugirango imyitwarire iboneye mubikoresho byose. - Kugirango ushushanye kumenyesha mugihe ubirukanye, menya kongeramo
.fade
amasomo.show
.
Urashobora kubibona mubikorwa hamwe na demo nzima:
<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>
Emera kwirukana integuza ukoresheje JavaScript:
Cyangwa hamwe data
nibiranga kuri buto mubimenyeshejwe , nkuko byerekanwe hejuru:
Menya ko gufunga integuza bizayikuraho muri DOM.
Uburyo | Ibisobanuro |
---|---|
$().alert() |
Kora integuza yumve gukanda ibyabaye kubintu bikomokaho bifite data-dismiss="alert" ikiranga. (Ntabwo ari ngombwa mugihe ukoresheje data-api yo gutangiza-auto.) |
$().alert('close') |
Funga integuza uyikuye muri DOM. Niba i .fade hamwe .show namasomo ahari kuri element, integuza izashira mbere yuko ikurwaho. |
$().alert('dispose') |
Gusenya ikintu cyo kumenyesha. |
Amacomeka ya Bootstrap yerekana ibintu bike byo guhuza ibikorwa.
Icyabaye | Ibisobanuro |
---|---|
close.bs.alert |
Ibirori birasa ako kanya mugihe close urugero rwitwa. |
closed.bs.alert |
Ibi birori birukanwa mugihe integuza yafunzwe (izategereza ko CSS ihinduka). |