Salá koleka na makambo ya ntina Salta na navigation ya docs
Check

Salelá plugin modal ya JavaScript ya Bootstrap mpo na kobakisa ba dialogues na site na yo mpo na ba lightbox, mayebisi ya mosaleli, to makambo oyo obongisi mpenza.

Ndenge oyo esalaka

Yambo ya kobanda na composant modal ya Bootstrap, sala makasi otanga oyo elandi lokola ba options na biso ya menu ebongwani kala mingi te.

  • Ba modales etongami na HTML, CSS, mpe JavaScript. Bazali positionné likolo ya nionso mosusu na mokanda mpe kolongola défilement na <body>mpo contenus modal défilement na esika.
  • Kofina na “fon d’écran” modal ekokanga automatiquement modal.
  • Bootstrap esimbaka kaka fenêtre modale moko na mbala moko. Ba modals encastrés esungami te lokola tondimi ete ezali ba expériences ya ba usagers ya mabe.
  • Modals use position: fixed, oyo ekoki ntango mosusu kozala mwa particulier na oyo etali rendu na yango. Ntango nyonso oyo likoki ezali, tyá HTML na yo ya modɛlɛ na esika ya nivo ya likoló mpo na koboya ete biloko mosusu ekɔta na makambo mosusu. Okozala mbala mosusu kokutana na makambo ntango ozali kosala nesting a na .modalkati ya élément mosusu fixe.
  • Encore une fois, en raison ya position: fixed, ezali na mua ba caveats na kosalela ba modals na ba appareils mobiles. Tala ba docs na biso ya soutien ya navigateur pona ba détails.
  • Na tina ya ndenge HTML5 elimbolaka sémantique na yango, attribut autofocusHTML ezali na effet moko te na ba modal ya Bootstrap. Mpo na kozwa eloko moko, salelá mwa JavaScript oyo olingi:
const myModal = document.getElementById('myModal')
const myInput = document.getElementById('myInput')

myModal.addEventListener('shown.bs.modal', () => {
  myInput.focus()
})
Effet ya animation ya composante oyo ezali dépendant na prefers-reduced-motionrequête ya média. Tala eteni ya mouvement réduit ya mikanda na biso ya accessibilité .

Koba kotanga mpo na ba démos mpe malako ya kosalela.

Bandakisa

En bas ezali exemple modal statiqueposition (elingi koloba ya yango mpe displaybasili ko overridé). Ezali na kati ya motó ya modale, nzoto ya modal (esengeli mpo na padding), mpe motó ya nse ya modal (ekoki kozala na bolingi). Tosengi ete otia ba têtes modales na ba actions ya démission soki likoki ezali, to opesa action mosusu ya démission ya polele.

<div class="modal" tabindex="-1">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">Modal title</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        <p>Modal body text goes here.</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

Démonstration en direct

Toggle démonstration modal ya mosala na ko cliquer bouton oyo ezali awa na se. Ekokita mpe ekosila na kati longwa na likoló ya lokasa.

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

Fond d'écran statique

Tango fond d'écran etie na statique, modal ekokangama te tango ozali ko cliquer libanda na yango. Finá na butɔ oyo ezali awa na nse mpo na komeka yango.

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#staticBackdrop">
  Launch static backdrop modal
</button>

<!-- Modal -->
<div class="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="staticBackdropLabel">Modal title</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Understood</button>
      </div>
    </div>
  </div>
</div>

Kosala défilement ya makambo milai

Tango ba modal ekomi milayi mingi pona viewport to appareil ya mosaleli, ezo défiler indépendamment ya page yango moko. Meka démonstration oyo ezali awa na se po omona nini tolingi koloba.

Okoki mpe kosala modal oyo ekoki ko défiler oyo epesaka nzela ya kosala défilement ya nzoto ya modal na kobakisa .modal-dialog-scrollablena .modal-dialog.

<!-- Scrollable modal -->
<div class="modal-dialog modal-dialog-scrollable">
  ...
</div>

Ezali na katikati ya verticale

Bakisa .modal-dialog-centeredna mpo na .modal-dialogko centrer verticalement modal.

<!-- Vertically centered modal -->
<div class="modal-dialog modal-dialog-centered">
  ...
</div>

<!-- Vertically centered scrollable modal -->
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
  ...
</div>

Ba toli ya bisaleli mpe ba popovers

Ba tops ya bisaleli mpe ba popovers ekoki kotiama na kati ya ba modals soki esengeli. Tango ba modal ekangami, ba totips nionso ya ba outils na ba popovers na kati pe ezo rejeter automatiquement.

<div class="modal-body">
  <h5>Popover in a modal</h5>
  <p>This <a href="#" role="button" class="btn btn-secondary" data-bs-toggle="popover" title="Popover title" data-bs-content="Popover body content is set in this attribute.">button</a> triggers a popover on click.</p>
  <hr>
  <h5>Tooltips in a modal</h5>
  <p><a href="#" data-bs-toggle="tooltip" title="Tooltip">This link</a> and <a href="#" data-bs-toggle="tooltip" title="Tooltip">that link</a> have tooltips on hover.</p>
</div>

Kosalela grille

Salelá système ya grille Bootstrap na kati ya modal moko na kosala zumbu na .container-fluidkati ya .modal-body. Na sima, salela ba classes ya système ya grille normal ndenge okosala esika mosusu nionso.

<div class="modal-body">
  <div class="container-fluid">
    <div class="row">
      <div class="col-md-4">.col-md-4</div>
      <div class="col-md-4 ms-auto">.col-md-4 .ms-auto</div>
    </div>
    <div class="row">
      <div class="col-md-3 ms-auto">.col-md-3 .ms-auto</div>
      <div class="col-md-2 ms-auto">.col-md-2 .ms-auto</div>
    </div>
    <div class="row">
      <div class="col-md-6 ms-auto">.col-md-6 .ms-auto</div>
    </div>
    <div class="row">
      <div class="col-sm-9">
        Level 1: .col-sm-9
        <div class="row">
          <div class="col-8 col-sm-6">
            Level 2: .col-8 .col-sm-6
          </div>
          <div class="col-4 col-sm-6">
            Level 2: .col-4 .col-sm-6
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

Contenu modal oyo ekeseni

Ozali na liboke ya ba boutons oyo nionso e déclencher modal moko na ba contenus un peu différent? Salelá event.relatedTargetmpe ba attributs HTMLdata-bs-* mpo na kobongola makambo oyo ezali na kati ya modal engebene bouton nini obɛtaki.

Awa na se ezali démonstration en direct elandi na exemple HTML na JavaScript. Mpo na koyeba makambo mingi, tanga mikanda ya makambo ya modal mpo na koyeba makambo mingi na relatedTarget.

html
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@mdo">Open modal for @mdo</button>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@fat">Open modal for @fat</button>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@getbootstrap">Open modal for @getbootstrap</button>

<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">New message</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        <form>
          <div class="mb-3">
            <label for="recipient-name" class="col-form-label">Recipient:</label>
            <input type="text" class="form-control" id="recipient-name">
          </div>
          <div class="mb-3">
            <label for="message-text" class="col-form-label">Message:</label>
            <textarea class="form-control" id="message-text"></textarea>
          </div>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Send message</button>
      </div>
    </div>
  </div>
</div>
const exampleModal = document.getElementById('exampleModal')
exampleModal.addEventListener('show.bs.modal', event => {
  // Button that triggered the modal
  const button = event.relatedTarget
  // Extract info from data-bs-* attributes
  const recipient = button.getAttribute('data-bs-whatever')
  // If necessary, you could initiate an AJAX request here
  // and then do the updating in a callback.
  //
  // Update the modal's content.
  const modalTitle = exampleModal.querySelector('.modal-title')
  const modalBodyInput = exampleModal.querySelector('.modal-body input')

  modalTitle.textContent = `New message to ${recipient}`
  modalBodyInput.value = recipient
})

Toggle kati na ba modal

Toggle entre ba modal ebele na mwa placement ya mayele ya ba data-bs-targetattributs data-bs-toggle. Ndakisa, okoki kobongola modal ya réinitialisation ya mot de passe uta na kati ya signe oyo esi efungwami na modal. Svp yeba ba modal ebele ekoki kofungwama na tango moko te —méthode oyo ezo toggler kaka entre ba modal mibale ekeseni.

Fungola liboso modal
html
<div class="modal fade" id="exampleModalToggle" aria-hidden="true" aria-labelledby="exampleModalToggleLabel" tabindex="-1">
  <div class="modal-dialog modal-dialog-centered">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalToggleLabel">Modal 1</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        Show a second modal and hide this one with the button below.
      </div>
      <div class="modal-footer">
        <button class="btn btn-primary" data-bs-target="#exampleModalToggle2" data-bs-toggle="modal">Open second modal</button>
      </div>
    </div>
  </div>
</div>
<div class="modal fade" id="exampleModalToggle2" aria-hidden="true" aria-labelledby="exampleModalToggleLabel2" tabindex="-1">
  <div class="modal-dialog modal-dialog-centered">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalToggleLabel2">Modal 2</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        Hide this modal and show the first with the button below.
      </div>
      <div class="modal-footer">
        <button class="btn btn-primary" data-bs-target="#exampleModalToggle" data-bs-toggle="modal">Back to first</button>
      </div>
    </div>
  </div>
</div>
<a class="btn btn-primary" data-bs-toggle="modal" href="#exampleModalToggle" role="button">Open first modal</a>

Bobongola animation

Variable $modal-fade-transforme déterminaka état ya transformation ya .modal-dialogavant animation ya fade-in modal, $modal-show-transformvariable e déterminaka transformation ya .modal-dialogna suka ya animation ya fade-in modal.

Soki olingi ndakisa animation ya zoom-in, okoki kotiya $modal-fade-transform: scale(.8).

Longola animation

Mpo na ba modal oyo emonanaka kaka na esika ya kosila mpo na kotala, longola .fadekelasi na bilembo na yo ya modal.

<div class="modal" tabindex="-1" aria-labelledby="..." aria-hidden="true">
  ...
</div>

Ba hauteurs dynamiques

Soki bosanda ya modal ebongwanaka ntango ezali polele, osengeli kobenga myModal.handleUpdate()mpo na kobongisa lisusu esika ya modal na likambo oyo barre de défilement ebimi.

Kozala na makoki ya kozwa yango

Kobosana te kobakisa aria-labelledby="...", kosala référence na titre modal, na .modal. En plus, okoki kopesa description ya dialogue modal na yo na aria-describedbyon .modal. Yeba que oza na besoin ya kobakisa role="dialog"te puisque tobakisi yango déjà via JavaScript.

Kokɔtisa ba vidéos ya YouTube

Ko intégrer ba vidéos ya YouTube na ba modals esengaka JavaScript ya kobakisa te na Bootstrap pona ko arrêter automatiquement lecture pe ebele. Tala post oyo ya Stack Overflow ya lisungi mpo na koyeba makambo mosusu.

Ba taille oyo okoki kopona

Ba modales ezali na ba taille misato ya option, oyo ezali na nzela ya ba classes ya modificateur oyo esengeli kotiama na .modal-dialog. Ba taille oyo ezo kick na ba points d'écart mosusu pona ko éviter ba barres de défilement horizontale na ba portes de vue ya mike.

Bonene Kelasi Modal max-largeur ya kosala
Moke .modal-sm 300px
Mbeba Moko te 500px
Monene .modal-lg 800px
Extra ya monene .modal-xl 1140px

Modal na biso ya par défaut sans modificateur classe e constituaka modal ya taille « moyenne ».

<div class="modal-dialog modal-xl">...</div>
<div class="modal-dialog modal-lg">...</div>
<div class="modal-dialog modal-sm">...</div>

Modal ya écran mobimba

Override mosusu ezali option ya ko pop up modal oyo ezo couvrir viewport ya usager, disponible via ba classes ya modificateur oyo etie na .modal-dialog.

Kelasi Disponibilité
.modal-fullscreen Ntango nyonso
.modal-fullscreen-sm-down 576px
.modal-fullscreen-md-down 768px
.modal-fullscreen-lg-down 992px
.modal-fullscreen-xl-down 1200px
.modal-fullscreen-xxl-down 1400px
<!-- Full screen modal -->
<div class="modal-dialog modal-fullscreen-sm-down">
  ...
</div>

CSS

Ba variables oyo ezali

Ebakisami na v5.2.0

Lokola eteni ya approche ya ba variables CSS oyo ezali ko évoluer ya Bootstrap, ba modals esalela sikoyo ba variables CSS locales na .modalmpe .modal-backdropmpo na personnalisation en temps réel oyo ematisami. Ba valeurs pona ba variables ya CSS etiamaki na nzela ya Sass, yango wana personnalisation ya Sass ezali kaka kosungama, pe.

  --#{$prefix}modal-zindex: #{$zindex-modal};
  --#{$prefix}modal-width: #{$modal-md};
  --#{$prefix}modal-padding: #{$modal-inner-padding};
  --#{$prefix}modal-margin: #{$modal-dialog-margin};
  --#{$prefix}modal-color: #{$modal-content-color};
  --#{$prefix}modal-bg: #{$modal-content-bg};
  --#{$prefix}modal-border-color: #{$modal-content-border-color};
  --#{$prefix}modal-border-width: #{$modal-content-border-width};
  --#{$prefix}modal-border-radius: #{$modal-content-border-radius};
  --#{$prefix}modal-box-shadow: #{$modal-content-box-shadow-xs};
  --#{$prefix}modal-inner-border-radius: #{$modal-content-inner-border-radius};
  --#{$prefix}modal-header-padding-x: #{$modal-header-padding-x};
  --#{$prefix}modal-header-padding-y: #{$modal-header-padding-y};
  --#{$prefix}modal-header-padding: #{$modal-header-padding}; // Todo in v6: Split this padding into x and y
  --#{$prefix}modal-header-border-color: #{$modal-header-border-color};
  --#{$prefix}modal-header-border-width: #{$modal-header-border-width};
  --#{$prefix}modal-title-line-height: #{$modal-title-line-height};
  --#{$prefix}modal-footer-gap: #{$modal-footer-margin-between};
  --#{$prefix}modal-footer-bg: #{$modal-footer-bg};
  --#{$prefix}modal-footer-border-color: #{$modal-footer-border-color};
  --#{$prefix}modal-footer-border-width: #{$modal-footer-border-width};
  
  --#{$prefix}backdrop-zindex: #{$zindex-modal-backdrop};
  --#{$prefix}backdrop-bg: #{$modal-backdrop-bg};
  --#{$prefix}backdrop-opacity: #{$modal-backdrop-opacity};
  

Ba variables ya Sass

$modal-inner-padding:               $spacer;

$modal-footer-margin-between:       .5rem;

$modal-dialog-margin:               .5rem;
$modal-dialog-margin-y-sm-up:       1.75rem;

$modal-title-line-height:           $line-height-base;

$modal-content-color:               null;
$modal-content-bg:                  $white;
$modal-content-border-color:        var(--#{$prefix}border-color-translucent);
$modal-content-border-width:        $border-width;
$modal-content-border-radius:       $border-radius-lg;
$modal-content-inner-border-radius: subtract($modal-content-border-radius, $modal-content-border-width);
$modal-content-box-shadow-xs:       $box-shadow-sm;
$modal-content-box-shadow-sm-up:    $box-shadow;

$modal-backdrop-bg:                 $black;
$modal-backdrop-opacity:            .5;

$modal-header-border-color:         var(--#{$prefix}border-color);
$modal-header-border-width:         $modal-content-border-width;
$modal-header-padding-y:            $modal-inner-padding;
$modal-header-padding-x:            $modal-inner-padding;
$modal-header-padding:              $modal-header-padding-y $modal-header-padding-x; // Keep this for backwards compatibility

$modal-footer-bg:                   null;
$modal-footer-border-color:         $modal-header-border-color;
$modal-footer-border-width:         $modal-header-border-width;

$modal-sm:                          300px;
$modal-md:                          500px;
$modal-lg:                          800px;
$modal-xl:                          1140px;

$modal-fade-transform:              translate(0, -50px);
$modal-show-transform:              none;
$modal-transition:                  transform .3s ease-out;
$modal-scale-transform:             scale(1.02);

Boucle

Ba modals ya écran mobimba oyo ezo répondre ezo generer via $breakpointscarte na boucle na scss/_modal.scss.

@each $breakpoint in map-keys($grid-breakpoints) {
  $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
  $postfix: if($infix != "", $infix + "-down", "");

  @include media-breakpoint-down($breakpoint) {
    .modal-fullscreen#{$postfix} {
      width: 100vw;
      max-width: none;
      height: 100%;
      margin: 0;

      .modal-content {
        height: 100%;
        border: 0;
        @include border-radius(0);
      }

      .modal-header,
      .modal-footer {
        @include border-radius(0);
      }

      .modal-body {
        overflow-y: auto;
      }
    }
  }
}

Kosalela yango

Plugin modal ebalusaka ba contenus na yo oyo ebombami na demande, na nzela ya ba attributs ya ba données to JavaScript. Ezali mpe koboya comportement ya défilement par défaut mpe ebimisaka a .modal-backdropmpo na kopesa esika ya kofina mpo na koboya ba modal oyo elakisami ntango ozali kofina libanda ya modal.

Na nzela ya ba attributs ya ba données

Toggle na esika na yango

Activer un modal sans kokoma JavaScript. Set data-bs-toggle="modal"na élément ya contrôleur, lokola bouton, elongo na data-bs-target="#foo"to href="#foo"mpo na ko cibler modal spécifique mpo na ko toggler.

<button type="button" data-bs-toggle="modal" data-bs-target="#myModal">Launch modal</button>

Kolongola

Kolongolama ekoki kosalema na dataattribut oyo ezali na bouton moko na kati ya modal ndenge emonisami awa na nse:

<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>

to na bouton moko libanda ya modal kosalelaka data-bs-targetndenge elakisami awa na nse:

<button type="button" class="btn-close" data-bs-dismiss="modal" data-bs-target="#my-modal" aria-label="Close"></button>
Atako banzela nyonso mibale ya koboya modal esungami, kobosana te ete koboya uta libanda ya modal ekokani te na motindo ya bokutani (modal) ya Buku ya Mimeseno ya Bokomi ya ARIA . Salá yango na likama na yo moko.

Na nzela ya JavaScript

Bosala modal na ligne moko ya JavaScript:

const myModal = new bootstrap.Modal(document.getElementById('myModal'), options)
// or
const myModalAlternative = new bootstrap.Modal('#myModal', options)

Makambo oyo okoki kopona

Lokola ba options ekoki koleka na nzela ya ba attributs ya ba données to JavaScript, okoki kobakisa kombo ya option na data-bs-, lokola na data-bs-animation="{value}". Sala makasi o changer type ya cas ya kombo ya option depuis “ camelCase ” na “ kebab-case ” tango ozali koleka ba options via ba attributs ya ba données. Na ndakisa, salelá data-bs-custom-class="beautifier"na esika ya data-bs-customClass="beautifier".

Kobanda na Bootstrap 5.2.0, ba composants nionso esungaka attribut ya ba données réservées expérimentalesdata-bs-config oyo ekoki ko louer configuration ya composant simple lokola chaîne JSON. Tango élément moko ezali data-bs-config='{"delay":0, "title":123}'na na ba data-bs-title="456"attributs, valeur ya suka titleekozala 456mpe ba attributs ya ba données separates eko overrider ba valeurs oyo epesami na data-bs-config. En plus, ba attributs ya ba données oyo ezali ezali capable ya ko louer ba valeurs JSON lokola data-bs-delay='{"show":0,"hide":150}'.

Nkombo Lolenge Mbeba Ndimbola
backdrop boolean, .'static' true Ezali na élément moko ya modal-backdrop. Na lolenge mosusu, lakisa staticmpo na fond d'écran oyo ekangaka modal te ntango ozali kofina.
focus boolean true Etie focus na modal tango e initialiser.
keyboard boolean true Ekangaka modal tango touche ya escape efinamaki.

Ba méthodes ya kosala

Ba méthodes asynchrones na ba transitions

Ba méthodes nionso ya API ezali asynchrone mpe ebandi transition . Bazongaka epai ya moto oyo abengi ntango kaka mbongwana ebandi kasi liboso ete esila . En plus, appel ya méthode na composante ya transition ekozala ignorée .

Tala mikanda na biso ya JavaScript mpo na koyeba makambo mosusu .

Ba options ya koleka

Active contenus na yo lokola modal. Andimi ba options moko ya option object.

const myModal = new bootstrap.Modal('#myModal', {
  keyboard: false
})
Metode Ndimbola
dispose Ebebisaka modal ya élément moko. (Elongolaka ba données oyo ebombami na élément DOM)
getInstance Méthode statique oyo e permettre yo ozua instance modal associée na élément DOM.
getOrCreateInstance Méthode statique oyo e permettre yo ozua instance modal associée na élément DOM, to osala ya sika au cas où ezalaki initialisé te.
handleUpdate Réajuster manuellement position ya modal soki hauteur ya modal ebongwanaki tango ezali polele (c.a.d. na cas barre de défilement ebimi).
hide Manuellement abombaka modal moko. Ezongi na mobengi yambo ete modal ebombama mpenza (elingi koloba liboso ete hidden.bs.modallikambo esalema).
show Manuellement efungolaka modal moko. Ezongi na mobengi yambo modal elakisama mpenza (elingi koloba liboso ete shown.bs.modallikambo esalema). Lisusu, okoki koleka élément DOM lokola argument oyo ekoki kozuama na ba événements modaux (lokola relatedTargetpropriété). (elingi koloba const modalToggle = document.getElementById('toggleMyModal'); myModal.show(modalToggle).
toggle Manuellement ebalukaka modal moko. Ezongi na mobengi yambo modal elakisama to ebombama mpenza (elingi koloba liboso ete likambo shown.bs.modalto hidden.bs.modalesalema).

Makambo oyo esalemaki

Classe modal ya Bootstrap e exposer mua ba événements pona ko crochet na fonctionnalité modal. Ba événements modaux nionso ezo betama na modal yango moko (c.a.d. na <div class="modal">).

Likambo Ndimbola
hide.bs.modal Evenement oyo ezo beta mbala moko tango hideméthode ya instance ebengami.
hidden.bs.modal Evenement oyo ezo beta tango modal esili kobombama na mosaleli (ekozela ba transitions ya CSS esila).
hidePrevented.bs.modal Événement oyo ezo beta tango modal elakisami, fond d'écran na yango ezali staticmpe clic moko libanda ya modal esalemi. Evenement ezo beta pe tango touche ya escape ezo finga pe keyboardoption etie na false.
show.bs.modal Evenement oyo ezo beta mbala moko tango showméthode ya instance ebengami. Soki euti na kofina, eloko oyo obɛti ezali lokola relatedTargeteloko ya likambo.
shown.bs.modal Evenement oyo ezo beta tango modal esalemi visible na mosaleli (ekozela ba transitions ya CSS esila). Soki euti na kofina, eloko oyo obɛti ezali lokola relatedTargeteloko ya likambo.
const myModalEl = document.getElementById('myModal')
myModalEl.addEventListener('hidden.bs.modal', event => {
  // do something...
})