Switsundzuxo
Nyika marungula ya mbuyelo wa xiyimo xa swiendlo swa mutirhisi leswi tolovelekeke hi voko ra marungula ya xitsundzuxo lama nga kona na lama cinca-cincaka.
Swikombiso
Switsundzuxo swa kumeka eka ku leha kwihi na kwihi ka tsalwa, xikan’we na buti yo hlongola leyi nga hlawuriwa. Ku kuma xitayili lexi faneleke, tirhisa yin’wana ya titlilasi ta tsevu leti lavekaka ta mongo (xikombiso, .alert-success
). Ku hlongoriwa endzeni ka layini, tirhisa switsundzuxo swa 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>
Ku hundzisela nhlamuselo eka thekinoloji yo pfuneta
Ku tirhisa muvala ku engetela nhlamuselo swi nyika ntsena xikombiso xa xivono, lexi nga ta ka xi nga hundziseriwi eka vatirhisi va thekinoloji yo pfuneta – ku fana na swihlaya swa xikirini. Tiyisisa leswaku mahungu lama kombisiweke hi muvala ya le rivaleni eka nhundzu hi yoxe (xikombiso tsalwa leri vonakaka), kumbe ya katsiwile hi tindlela tin’wana, ku fana na tsalwa ro engetela leri fihliweke na .sr-only
tlilasi.
Hlanganisa muvala
Tirhisa .alert-link
tlilasi ya vukorhokeri ku hatlisa u nyika swihlanganisi swa mihlovo leyi fambelanaka endzeni ka xitsundzuxo xihi na xihi.
<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>
Swilo leswi engetelekeke
Switsundzuxo swi nga tlhela swi va na swiaki swo engetela swa HTML swo fana na tinhlokomhaka, tindzimana na swihambanisi.
Tirhe kahle!
Aww yeah, u hlaye hi ndlela leyi humelelaka rungula leri ra nkoka ra xitsundzuxo. Tsalwa leri ra xikombiso ri ta famba nkarhi wo leha nyana leswaku u ta kota ku vona ndlela leyi ku hambana endzeni ka xitsundzuxo ku tirhaka ha yona na muxaka lowu wa nhundzu.
Nkarhi wun’wana ni wun’wana loko u lava, tiyiseka leswaku u tirhisa switirhisiwa swa margin leswaku swilo swi tshama swi ri kahle naswona swi hlelekile.
<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>
Ku hlongola
Hi ku tirhisa xitsundzuxo xa JavaScript plugin, swa koteka ku bakanya xitsundzuxo xihi na xihi lexi nga endzeni ka layini. Hi leyi ndlela leyi:
- Tiyisisa leswaku u layicha xiengetelo xa xitsundzuxo, kumbe JavaScript ya Bootstrap leyi hlengeletiweke.
- Loko u aka JavaScript ya hina ku suka eka xihlovo, swi lava
util.js
. Vuhundzuluxeri lebyi hlengeletiweke byi katsa leswi. - Engetela buti yo hlongola na
.alert-dismissible
tlilasi, leswi engetelaka padding yo engetela etlhelo ra xinene ra xitsundzuxo ivi swi veka.close
buti. - Eka buti yo hlongola, engetela
data-dismiss="alert"
xihlawulekisi, lexi pfuxaka ntirho wa JavaScript. Tiyisisa leswaku u tirhisa<button>
elemente na yona eka mahanyelo lama faneleke eka switirhisiwa hinkwaswo. - Ku endla leswaku switsundzuxo swi hanya loko u swi hlongola, tiyiseka leswaku u engetela titlilasi ta
.fade
na ..show
U nga vona leswi swi ri karhi swi tirha hi demo leyi hanyaka:
<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>
Mahanyelo ya JavaScript
Swihlohloteri
Endla leswaku ku hlongoriwa ka xitsundzuxo ku tirha hi ku tirhisa JavaScript:
$('.alert').alert()
Kumbe hi data
swihlawulekisi eka buti endzeni ka xitsundzuxo , hilaha swi kombisiweke hakona laha henhla:
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
Xiya leswaku ku pfala xitsundzuxo swi ta xi susa eka DOM.
Maendlelo
Ndlela | Nhlamuselo |
---|---|
$().alert() |
Endla leswaku xitsundzuxo xi yingisela swiendlakalo swa ku tsindziyela eka swiaki swa vatukulu leswi nga na data-dismiss="alert" xihlawulekisi. (A swi bohi loko u tirhisa ku sungula ka data-api hi ku tisungulela.) |
$().alert('close') |
Ku pfala xitsundzuxo hi ku xi susa eka DOM. Loko titlilasi ta .fade na .show ti ri kona eka elemente, xitsundzuxo xi ta nyamalala xi nga si susiwa. |
$().alert('dispose') |
Ku herisa xitsundzuxo xa elemente. |
$('.alert').alert('close')
Swiendlakalo
Plugin ya xitsundzuxo ya Bootstrap yi paluxa swiendlakalo swi nga ri swingani swo khoma eka ntirho wa xitsundzuxo.
Nkhuvo | Nhlamuselo |
---|---|
close.bs.alert |
Xiendlakalo lexi xi pfurha hi ku hatlisa loko ku close vitaniwa ndlela ya xikombiso. |
closed.bs.alert |
Xiendlakalo lexi xi pfuriwa loko xitsundzuxo xi pfariwile (xi ta rindza ku cinca ka CSS ku hela). |
$('#myAlert').on('closed.bs.alert', function () {
// do something...
})