I-Modal
Sebenzisa i-plugin ye-modal ye-Bootstrap ye-JavaScript ukwengeza izingxoxo kusayithi lakho ukuze uthole amabhokisi okukhanya, izaziso zabasebenzisi, noma okuqukethwe ngokwezifiso ngokuphelele.
Isebenza kanjani
Ngaphambi kokuthi uqale nge-modal ye-Bootstrap, qiniseka ukuthi ufunda okulandelayo njengoba izinketho zethu zemenyu zisanda kushintsha.
- Amamodeli akhiwe nge-HTML, CSS, neJavaScript. Abekwe phezu kwayo yonke enye into kudokhumenti futhi asuse ukuskrola kokuthi
<body>
okuqukethwe kwe-modal kuskrole esikhundleni salokho. - Ukuchofoza "okungemuva" kwe-modal kuzovala ngokuzenzakalelayo i-modal.
- I-Bootstrap isekela kuphela iwindi lemodali eyodwa ngesikhathi. Amamodeli afakwe esidlekeni awasekelwa njengoba sikholelwa ukuthi awamazi kahle abasebenzisi.
- Amamodali asebenzisa
position: fixed
, okungenzeka ukuthi ngezinye izikhathi athize mayelana nokunikezwa kwawo. Noma nini lapho kunokwenzeka, beka i-modal yakho ye-HTML endaweni yezinga eliphezulu ukuze ugweme ukuphazamiseka okungaba khona okuvela kwezinye izici. Cishe uzohlangabezana nezinkinga lapho wenza isidleke.modal
phakathi kwenye into elungisiwe. - Nakulokhu, ngenxa
position: fixed
ye-, kuneminye imixwayiso ngokusebenzisa ama-modal kumadivayisi eselula. Bona amadokhumenti asekela isiphequluli sethu ukuze uthole imininingwane. - Ngenxa yokuthi i-HTML5 iyichaza kanjani i-semantics yayo, isibaluli se-
autofocus
HTML asinawo umthelela kumamodeli we-Bootstrap. Ukuze uthole umphumela ofanayo, sebenzisa i-JavaScript yangokwezifiso:
var myModal = document.getElementById('myModal')
var myInput = document.getElementById('myInput')
myModal.addEventListener('shown.bs.modal', function () {
myInput.focus()
})
prefers-reduced-motion
embuzweni wemidiya. Bona ingxenye
yokunyakaza encishisiwe yemibhalo yethu yokufinyeleleka .
Qhubeka ufunda amademo nemihlahlandlela yokusebenzisa.
Izibonelo
Izingxenye ze-Modal
Ngezansi isibonelo se-modal esimileposition
(okusho ukuthi saso futhi display
sikhishiwe). Kufakwe unhlokweni we-modal, umzimba we-modal (uyadingeka padding
), kanye nonyaweni we-modal (ongakukhetha). Sicela ukuthi ufake izihloko ze-modal ezinezenzo zokucashisa noma nini lapho kunokwenzeka, noma unikeze esinye isenzo sokuchitha esisobala.
<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>
Idemo ebukhoma
Guqula idemo yemodi yokusebenza ngokuchofoza inkinobho engezansi. Izoshelela phansi bese ifiphala kusukela phezulu kwekhasi.
<!-- 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>
Ingemuva elimile
Uma okwasemuva kusethelwe ku-static, i-modal ngeke ivale uma uchofozwa ngaphandle kwayo. Chofoza inkinobho engezansi ukuze uyizame.
<!-- 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>
Ukuskrola okuqukethwe okude
Uma amamodeli eba made kakhulu endaweni yokubuka yomsebenzisi noma idivayisi, bayaskrola ngaphandle kwekhasi ngokwalo. Zama idemo engezansi ukuze ubone ukuthi siqonde ukuthini.
Ungakwazi futhi ukudala i-modal enyakaziswayo evumela ukuskrola umzimba we-modal ngokwengeza .modal-dialog-scrollable
kokuthi .modal-dialog
.
<!-- Scrollable modal -->
<div class="modal-dialog modal-dialog-scrollable">
...
</div>
Kuphakathi nendawo
Engeza .modal-dialog-centered
ukuze .modal-dialog
umise phakathi nendawo imodali ngokuqondile.
<!-- 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>
Amathuluzi kanye popover
Izeluleko zamathuluzi kanye ne- popover zingafakwa ngaphakathi kwamamodeli njengoba kudingeka. Uma amamodeli avaliwe, noma yimaphi amathiphu nama-popover ngaphakathi nawo achithwa ngokuzenzakalelayo.
<div class="modal-body">
<h5>Popover in a modal</h5>
<p>This <a href="#" role="button" class="btn btn-secondary popover-test" 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="#" class="tooltip-test" title="Tooltip">This link</a> and <a href="#" class="tooltip-test" title="Tooltip">that link</a> have tooltips on hover.</p>
</div>
Ukusebenzisa igridi
Sebenzisa isistimu yegridi ye-Bootstrap ngaphakathi kwe-modal ngokuzalela .container-fluid
ngaphakathi kwe- .modal-body
. Bese, sebenzisa amakilasi esistimu yegridi evamile njengoba ubungenza kwenye indawo.
<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>
Ukushintshashintsha kokuqukethwe kwe-modal
Unenqwaba yezinkinobho zonke ezicupha i-modal efanayo ngokuqukethwe okuhluke kancane? Sebenzisa event.relatedTarget
kanye nezibaluli ze- HTMLdata-bs-*
ukuze uguqule okuqukethwe kwe-modal kuye ngokuthi iyiphi inkinobho echofozwe.
Ngezansi kunedemo ebukhoma elandelwa isibonelo se-HTML ne-JavaScript. Ukuze uthole ulwazi olwengeziwe, funda amadokhumenti emicimbi ye-modal ukuze uthole imininingwane kokuthi relatedTarget
.
<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>
var exampleModal = document.getElementById('exampleModal')
exampleModal.addEventListener('show.bs.modal', function (event) {
// Button that triggered the modal
var button = event.relatedTarget
// Extract info from data-bs-* attributes
var 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.
var modalTitle = exampleModal.querySelector('.modal-title')
var modalBodyInput = exampleModal.querySelector('.modal-body input')
modalTitle.textContent = 'New message to ' + recipient
modalBodyInput.value = recipient
})
Guqula phakathi kwamamodeli
Guqula phakathi kwamamodeli amaningi ngokubeka okuthile okuhlakaniphile kwezimpawu data-bs-target
kanye data-bs-toggle
nezibaluli. Isibonelo, ungaguqula i-modal yokusetha kabusha iphasiwedi ngaphakathi kwe-modal yokungena evele ivuliwe. Sicela wazi ukuthi amamodeli amaningi awakwazi ukuvulwa ngesikhathi esisodwa—le ndlela imane iguqule phakathi kwamamodeli amabili ahlukene.
<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" data-bs-dismiss="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" data-bs-dismiss="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>
Shintsha ukugqwayiza
Okuguquguqukayo $modal-fade-transform
kunquma isimo soguquko .modal-dialog
sangaphambi kokugqwayiza kwe-modal fade-in, $modal-show-transform
okuhlukile kunquma ukuguqulwa .modal-dialog
ekupheleni kwe-modal fade-in animation.
Uma ufuna ngokwesibonelo i-zoom-in animation, ungasetha $modal-fade-transform: scale(.8)
.
Susa ukugqwayiza
Kumamodeli avele avele kunokuba afiphele ukuze abukwe, susa .fade
ikilasi kumakhaphu akho e-modal.
<div class="modal" tabindex="-1" aria-labelledby="..." aria-hidden="true">
...
</div>
Ukuphakama okunamandla
Uma ukuphakama kwe-modal kushintsha ngenkathi ivuliwe, kufanele ushayele myModal.handleUpdate()
ukuze ulungise indawo ye-modal uma kwenzeka kuvela ibha yokuskrola.
Ukufinyeleleka
Qiniseka ukuthi uyengeza aria-labelledby="..."
, ubhekisela kusihloko se-modal, ku .modal
. Ukwengeza, unganikeza incazelo yengxoxo yakho ye-modal nge- aria-describedby
on .modal
. Qaphela ukuthi awudingi ukungeza role="dialog"
njengoba sesivele sengeze nge-JavaScript.
Ishumeka amavidiyo e-YouTube
Ukushumeka amavidiyo e-YouTube kumamodeli kudinga i-JavaScript eyengeziwe engekho ku-Bootstrap ukuze kumiswe ukudlalwa ngokuzenzakalelayo nokunye. Bona lokhu okuthunyelwe okuchichima kwesitaki okuwusizo ukuze uthole ulwazi olwengeziwe.
Osayizi abazikhethela
Amamodeli anosayizi abathathu abazikhethela, atholakala ngamakilasi okulungisa azobekwa ku- .modal-dialog
. Laba bosayizi bangena ezindaweni ezithile zokuphumula ukuze bagweme amabha okuskrola avundlile ezimbobeni zokubuka ezinciphile.
Usayizi | Ikilasi | I-Modal max-width |
---|---|---|
Encane | .modal-sm |
300px |
Okuzenzakalelayo | Lutho | 500px |
Okukhulu | .modal-lg |
800px |
Okukhulu kakhulu | .modal-xl |
1140px |
I-modal yethu ezenzakalelayo ngaphandle kwesigaba sokuguqula ihlanganisa usayizi "omaphakathi".
<div class="modal-dialog modal-xl">...</div>
<div class="modal-dialog modal-lg">...</div>
<div class="modal-dialog modal-sm">...</div>
I-Modal yesikrini esigcwele
Okunye ukukhipha inketho yokuveza i-modal emboza imbobo yokubuka yomsebenzisi, etholakala ngamakilasi okulungisa abekwe ku- .modal-dialog
.
Ikilasi | Ukutholakala |
---|---|
.modal-fullscreen |
Njalo |
.modal-fullscreen-sm-down |
Ngezansi576px |
.modal-fullscreen-md-down |
Ngezansi768px |
.modal-fullscreen-lg-down |
Ngezansi992px |
.modal-fullscreen-xl-down |
Ngezansi1200px |
.modal-fullscreen-xxl-down |
Ngezansi1400px |
<!-- Full screen modal -->
<div class="modal-dialog modal-fullscreen-sm-down">
...
</div>
Sass
Okuguquguqukayo
$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: rgba($black, .2);
$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: $border-color;
$modal-footer-border-color: $modal-header-border-color;
$modal-header-border-width: $modal-content-border-width;
$modal-footer-border-width: $modal-header-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-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);
Iluphu
Amamodeli esikrini esigcwele aphendulayo akhiqizwa $breakpoints
ngemephu kanye ne-loop ku- 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 {
@include border-radius(0);
}
.modal-body {
overflow-y: auto;
}
.modal-footer {
@include border-radius(0);
}
}
}
}
Ukusetshenziswa
I-plugin ye-modal iguqula okuqukethwe kwakho okufihliwe ngokufunwa, ngezibaluli zedatha noma i-JavaScript. Iphinda ikhiphe ukuziphatha kokuskrola okuzenzakalelayo futhi ikhiqize .modal-backdrop
ukuhlinzeka ngendawo yokuchofoza yokucashisa amamodeli abonisiwe lapho uchofozwa ngaphandle kwe-modal.
Ngezibaluli zedatha
Yenza kusebenze i-modal ngaphandle kokubhala i-JavaScript. Misa data-bs-toggle="modal"
into yesilawuli, njengenkinobho, kanye ne-a data-bs-target="#foo"
noma href="#foo"
ukuze uqondise i-modal ethile ukuze uyiguqule.
<button type="button" data-bs-toggle="modal" data-bs-target="#myModal">Launch modal</button>
Nge-JavaScript
Dala i-modal ngomugqa owodwa we-JavaScript:
var myModal = new bootstrap.Modal(document.getElementById('myModal'), options)
Izinketho
Izinketho zingadluliswa ngezibaluli zedatha noma i-JavaScript. Ukuze uthole izibaluli zedatha, faka igama lenketho kokuthi data-bs-
, njengaku data-bs-backdrop=""
.
Igama | Uhlobo | Okuzenzakalelayo | Incazelo |
---|---|---|---|
backdrop |
i-boolean noma intambo'static' |
true |
Kufaka phakathi i-elementi ye-modal-backdrop. Noma, cacisa static okwasemuva okungavali i-modal lapho uchofozwa. |
keyboard |
boolean | true |
Ivala i-modal lapho ukhiye we-escape ucindezelwa |
focus |
boolean | true |
Ibeka ukugxila ku-modal lapho iqaliswa. |
Izindlela
Izindlela ze-Asynchronous kanye noshintsho
Zonke izindlela ze-API azivumelanisi futhi ziqala inguquko . Babuyele kofonayo uma sekuqalwa uguquko kodwa lungakapheli . Ngokungeziwe, ikholi yendlela engxenyeni yoshintsho izozitshwa .
Bheka imibhalo yethu ye-JavaScript ukuze uthole ulwazi olwengeziwe .
Izinketho zokudlula
Yenza okuqukethwe kwakho kusebenze njengemodeli. Yamukela izinketho ozikhethela object
.
var myModal = new bootstrap.Modal(document.getElementById('myModal'), {
keyboard: false
})
guqula
Iguqula ngokwenza i-modal. Ibuyela kofonayo ngaphambi kokuba imodali ikhonjiswe noma ifihlwe (okungukuthi ngaphambi kokuba kwenzeke shown.bs.modal
noma hidden.bs.modal
isigameko).
myModal.toggle()
umbukiso
Ivula mathupha i-modal. Ibuyela kofonayo ngaphambi kokuthi imodali ikhonjiswe (okungukuthi ngaphambi kokuba shown.bs.modal
umcimbi wenzeke).
myModal.show()
Futhi, ungadlulisa isici se-DOM njengengxabano engatholwa kumicimbi ye-modal (njengesakhiwo relatedTarget
).
var modalToggle = document.getElementById('toggleMyModal') // relatedTarget
myModal.show(modalToggle)
fihla
Ifihla i-modal ngokwenza. Ibuyela kofonayo ngaphambi kokuthi i-modal ifihlekile (okungukuthi ngaphambi kokuthi hidden.bs.modal
kwenzeke umcimbi).
myModal.hide()
phathaBuyekeza
lungisa mathupha indawo ye-modal uma ukuphakama kwe-modal kushintsha ngenkathi ivuliwe (okungukuthi uma kwenzeka kuvela ibha yokuskrola).
myModal.handleUpdate()
lahla
Icekela phansi i-modal yento ethile. (Isusa idatha egciniwe kusici se-DOM)
myModal.dispose()
getInstance
Indlela emile ekuvumela ukuthi uthole isibonelo se-modal esihlotshaniswa nento ye-DOM
var myModalEl = document.getElementById('myModal')
var modal = bootstrap.Modal.getInstance(myModalEl) // Returns a Bootstrap modal instance
getOrCreateInstance
Indlela emile ekuvumela ukuthi uthole imodeli ye-modal ehlotshaniswa nesici se-DOM, noma udale entsha uma kwenzeka ingaqalwanga
var myModalEl = document.querySelector('#myModal')
var modal = bootstrap.Modal.getOrCreateInstance(myModalEl) // Returns a Bootstrap modal instance
Imicimbi
Ikilasi le-modal ye-Bootstrap lidalula imicimbi embalwa ukuze ixhume ekusebenzeni kwe-modal. Yonke imicimbi ye-modal ixoshwa ku-modal ngokwayo (okungukuthi ku- <div class="modal">
).
Uhlobo lomcimbi | Incazelo |
---|---|
show.bs.modal |
Lo mcimbi uvutha ngokushesha lapho show indlela yesibonelo ibizwa. Uma kubangelwa ukuchofoza, into echofoziwe iyatholakala njengempahla relatedTarget yomcimbi. |
shown.bs.modal |
Lo mcimbi uyaxoshwa uma i-modal yenziwe yabonakala kumsebenzisi (izolinda ukuthi ukuguqulwa kwe-CSS kuqedwe). Uma kubangelwa ukuchofoza, into echofoziwe iyatholakala njengempahla relatedTarget yomcimbi. |
hide.bs.modal |
Lo mcimbi uxoshwa ngokushesha lapho hide indlela yesibonelo ibizwa. |
hidden.bs.modal |
Lo mcimbi uyaxoshwa lapho i-modal isiqedile ukufihlwa kumsebenzisi (izolinda ukuthi ukuguqulwa kwe-CSS kuqedwe). |
hidePrevented.bs.modal |
Lo mcimbi uyaxoshwa uma i-modal iboniswa, ingemuva layo liwukuthi static futhi ukuchofoza ngaphandle kwe-modal noma ukucindezela ukhiye wokuphunyuka kwenziwa ngenketho yekhibhodi noma data-bs-keyboard kusethelwe ku- false . |
var myModalEl = document.getElementById('myModal')
myModalEl.addEventListener('hidden.bs.modal', function (event) {
// do something...
})