Source

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">
  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>
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-onlynekirasi.

Shandisa .alert-linkutility kirasi kukurumidza kupa anoenderana mavara ekubatanidza mukati meyambiro ipi neipi.

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

Zvimwe zvemukati

Yambiro inogona zvakare kuve nekuwedzera HTML zvinhu senge misoro, ndima uye divider.

<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, zvinodautil.js . Iyo yakaunganidzwa vhezheni inosanganisira iyi.
  • Wedzera bhatani rekudzinga uye .alert-dismissiblekirasi, iyo inowedzera imwe padding kurudyi rweyambiro uye inoisa .closebhatani.
  • 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 .fadeuye .showmakirasi.

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">&times;</span>
  </button>
</div>

JavaScript maitiro

Zvikonzero

Ita kuti chenjedzo iraswe kuburikidza neJavaScript:

$('.alert').alert()

Kana datanehunhu pabhatani mukati meyambiro , sezvaratidzwa pamusoro:

<button type="button" class="close" data-dismiss="alert" aria-label="Close">
  <span aria-hidden="true">&times;</span>
</button>

Ziva kuti kuvhara yambiro kuchaibvisa kubva kuDOM.

Nzira

Nzira Tsanangudzo
$().alert() Inoita yambiro yekuteerera kune zviitiko zvekudzvanya pane zvedzinza zvine data-dismiss="alert"hunhu. (Hazvina basa kana uchishandisa iyo data-api's auto-initialization.)
$().alert('close') Inovhara yambiro nekuibvisa muDOM. Kana iyo .fadeuye .showmakirasi 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 closenzira yemuenzaniso inodanwa.
closed.bs.alert Ichi chiitiko chinodzingwa kana yambiro yavharwa (ichamirira CSS shanduko kuti ipere).
$('#myAlert').on('closed.bs.alert', function () {
  // do something…
})