Source

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-onlytlilasi.

Tirhisa .alert-linktlilasi 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.

<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 lavautil.js . Vuhundzuluxeri lebyi hlengeletiweke byi katsa leswi.
  • Engetela buti yo hlongola na .alert-dismissibletlilasi, leswi engetelaka padding yo engetela etlhelo ra xinene ra xitsundzuxo ivi swi veka .closebuti.
  • 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 .fadena ..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">&times;</span>
  </button>
</div>

Mahanyelo ya JavaScript

Swihlohloteri

Endla leswaku ku hlongoriwa ka xitsundzuxo ku tirha hi ku tirhisa JavaScript:

$('.alert').alert()

Kumbe hi dataswihlawulekisi 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">&times;</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 .fadena .showti 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 closevitaniwa 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…
})