in English

Izilumkiso

Nikezela ngemiyalezo yengxelo yomxholo kwiintshukumo eziqhelekileyo zabasebenzisi kunye nesandla semiyalezo efumanekayo neguqukayo yesilumkiso.

Imizekelo

Izivuseleli ziyafumaneka kulo naliphi na ubude bombhalo, kunye neqhosha lokuchitha elikhethiweyo. Ukwenza isimbo esifanelekileyo, sebenzisa enye kwiiklasi ezisibhozo ezifunekayo.alert-success (umz., ). Xa ugxothwa ngaphakathi, sebenzisa iplagi yezaziso zejQuery .

<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>
Ukuhambisa intsingiselo kwiiteknoloji ezincedisayo

Ukusebenzisa umbala ukongeza intsingiselo kubonelela kuphela ngesalathiso esibonakalayo, esingayi kuthunyelwa kubasebenzisi betekhnoloji encedisayo - njengezifundi zesikrini. Qinisekisa ukuba ulwazi olubonakaliswe ngumbala lucacile kumxholo ngokwawo (umzekelo, umbhalo obonakalayo), okanye luqukwe ngezinye iindlela, ezifana nesicatshulwa esongezelelweyo esifihlwe .sr-onlyeklasini.

Sebenzisa .alert-linkiklasi eluncedo ukubonelela ngokukhawuleza amakhonkco ahambelanayo anemibala ngaphakathi nasiphi na isivuseleli.

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

Umxholo owongezelelweyo

Izivuseleli zinokuqulatha izinto ezongezelelweyo zeHTML njengezihloko, imihlathi kunye nezahluli.

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

Ukugxotha

Usebenzisa isivuseleli seplagi yeJavaScript, kuyenzeka ukuba ugxothe nasiphi na isivuseleli emgceni. Nantsi indlela:

  • Qinisekisa ukuba ulayishile iplagi yesivuseleli, okanye i-JavaScript ye-Bootstrap ehlanganisiweyo.
  • Ukuba wakha iJavaScript yethu kwimvelaphi, kufunautil.js . Inguqulelo ehlanganisiweyo ibandakanya oku.
  • Yongeza iqhosha lokugxotha kunye .alert-dismissibleneklasi, eyongeza i-padding eyongezelelweyo ngasekunene kwesivuseleli kwaye ibeka .closeiqhosha.
  • Kwiqhosha lokugxotha, yongeza data-dismiss="alert"uphawu loyelelwano, oluqalisa ukusebenza kweJavaScript. Qinisekisa ukusebenzisa <button>ielementi kunye nayo ngokuziphatha okufanelekileyo kuzo zonke izixhobo.
  • Ukuvuselela izilumkiso xa uzigxotha, qiniseka ukuba wongeza .fadekunye .showneeklasi.

Ungayibona le nto isebenza ngedemo ephilayo:

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

Ukuziphatha kweJavaScript

Izichukumisi

Vula ukugxothwa kwesivuseleli ngeJavaScript:

$('.alert').alert()

Okanye ngeempawu datakwiqhosha elingaphakathi kwesivuseleli , njengoko kubonisiwe ngasentla:

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

Qaphela ukuba ukuvala isilumkiso kuya kusisusa kwi-DOM.

Iindlela

Indlela Inkcazo
$().alert() Yenza isivuseleli umamele ukwenzela unqakrazo lweziganeko kwizinto eziphumayo data-dismiss="alert"ezinophawu. (Akuyomfuneko xa usebenzisa idatha-api's auto-initialization.)
$().alert('close') Ivala isilumkiso ngokusisusa kwiDOM. Ukuba i .fadekunye .showneeklasi zikhona kwinto, isivuseleli siya kuphelelwa phambi kokuba sisuswe.
$().alert('dispose') Itshabalalisa isilumkiso sento.
$('.alert').alert('close')

Iziganeko

Iplagi yesilumkiso ye-Bootstrap iveza iminyhadala embalwa yokuqhagamshelwa kusetyenziso lwesilumkiso.

Isiganeko Inkcazo
close.bs.alert Esi siganeko sivutha ngokukhawuleza xa closekubizwa indlela yomzekelo.
closed.bs.alert Esi siganeko sigxothwa xa isivuseleli sivaliwe (siya kulinda iinguqu zeCSS ukuba zigqitywe).
$('#myAlert').on('closed.bs.alert', function () {
  // do something...
})