Slide Over
Blank Slide Over
Slide Over Size
Slide Over With Close Button
Overlapping Slide Over
Header & Footer Slide Over
Programmatically Show/Hide Slide Over
Methods
Get or Create Instance
Static method which allows you to get the slide over instance associated with a DOM element, or create a new one in case it wasn’t initialized.
const mySlideOver = tailwind.Modal.getOrCreateInstance(document.querySelector("#mySlideOver"));
Get Instance
Static method which allows you to get the slide over instance associated with a DOM element.
const mySlideOver = tailwind.Modal.getInstance(document.querySelector("#mySlideOver"));
Hide
Manually hides a slide over. Returns to the caller before the slide over has actually been hidden (i.e. before the hidden.tw.modal event occurs).
mySlideOver.hide();
Show
Manually opens a slide over. Returns to the caller before the slide over has actually been shown (i.e. before the shown.tw.modal event occurs).
mySlideOver.show();
Toggle
Manually toggles a slide over. Returns to the caller before the slide over has actually been shown or hidden (i.e. before the shown.tw.modal or hidden.tw.modal event occurs).
mySlideOver.toggle();
Events
Midone’s slide over class exposes a few events for hooking into slide over functionality. All slide over events are fired at the slide over itself (i.e. at the <div class="modal modal-slide-over">).
| Event type | Description |
|---|---|
| show.tw.modal | This event fires immediately when the show instance method is called. |
| shown.tw.modal | This event is fired when the slide over has been made visible to the user (will wait for CSS transitions to complete) |
| hide.tw.modal | This event is fired immediately when the hide instance method has been called. |
| hidden.tw.modal | This event is fired when the slide over has finished being hidden from the user (will wait for CSS transitions to complete). |
const mySlideOverEl = document.getElementById('mySlideOver') mySlideOverEl.addEventListener('hidden.tw.modal', function (event) { // do something... })