Modals
They support a number of use cases from user notification to completely custom content and feature a subcomponents, sizes, and more.
Modal Types
For fixed mode add bas-ui-modal-fixed
after bas-ui-modal
.
Modal Sizes
For diferent modal sizes add the bas-ui-modal-small
or bas-ui-modal-medium
after bas-ui-modal
.
Modal Positions
For diferent positions add the bas-ui-modal-top-sheet
or bas-ui-modal-bottom-sheet
or bas-ui-modal-left-sheet
or bas-ui-modal-right-sheet
or bas-ui-modal-full-sheet
after bas-ui-modal
.
Modal Structure
For set Trigger, specify the Modal ID in data-target or href and add bas-ui-modal-trigger
in the class item.
<!-- Modal Trigger -->
<a data-target="bas-ui-modal-sample1" class="bas-ui-button bas-ui-button-primary bas-ui-waves-light bas-ui-modal-trigger">Show Modal</a>
<!-- Modal -->
<div id="bas-ui-modal-sample1" class="bas-ui-modal">
<!-- Header -->
<div class="bas-ui-modal-header">
<div class="header-title">
<i class="mdi mdi-settings bas-ui-icon bas-ui-icon-left bas-ui-icon-24"></i>
<span class="section-title">Modal Header</span>
</div>
<ul class="right bas-ui-nav-menu">
<li class="bas-ui-nav-menu-item-icon">
<a class="bas-ui-button bas-ui-button-default bas-ui-button-flat bas-ui-button-fab bas-ui-button-fab-xs bas-ui-waves">
<i class="mdi mdi-dots-vertical bas-ui-icon"></i>
</a>
</li>
</ul>
</div>
<!-- Content -->
<div class="bas-ui-modal-content">
<h5>Title</h5>
<p>Duis bibendum nisl quis tellus rutrum, ut aliquet massa interdum. Mauris sit amet nisl augue.</p>
</div>
<!-- Footer -->
<div class="bas-ui-modal-footer">
<a href="#" class="bas-ui-button bas-ui-button-default bas-ui-button-flat bas-ui-waves secondary-color-text bas-ui-modal-close">Agree</a>
<a href="#" class="bas-ui-button bas-ui-button-default bas-ui-button-flat bas-ui-waves secondary-color-text bas-ui-modal-close">Disagree</a>
</div>
</div>
Initialization
Initialization for modals is only necessary if you create them dynamically.
$(document).ready(function(){
$('.bas-ui-modal-trigger').bas_ui_modals({
dismissible: true, // Modal can be dismissed by clicking outside of the modal
opacity: 0.5, // Opacity of modal background
in_duration: 300, // Transition in duration
out_duration: 200, // Transition out duration
});
});
Options
Option Name | Description |
---|---|
in_duration | The duration of the transition enter in milliseconds. Default: 300 |
out_duration | The duration of the transition out in milliseconds. Default: 200 |
opacity | Opacity of modal background. Default: 0.5 |
dismissible | Modal can be dismissed by clicking outside of the modal. Default: true |
To use these inline you have to add them as data attributes.
<!-- Modal Trigger -->
<a data-target="bas-ui-modal-sample1" data-opacity="0.8" data-dismissible="true" class="bas-ui-button bas-ui-button-primary bas-ui-waves-light bas-ui-modal-trigger"></a>
Methods
Shows a modal element.
$('.bas-ui-modal-trigger-custom-1').bas_ui_modals('show');
Hides a modal element.
$('.bas-ui-modal-trigger-custom-1').bas_ui_modals('hide');
Events
Option Name | Description |
---|---|
show.bas.modals | This event fires immediately when the show instance method is called. |
shown.bas.modals | This event is fired when a modal has been made visible to the user (will wait for CSS transitions to complete). |
hide.bas.modals | This event is fired immediately when the hide method has been called. |
hidden.bas.modals | This event is fired when a modal has been hidden from the user (will wait for CSS transitions to complete). |
Sample event.
$('#bas-ui-modal-sample1').on('shown.bas.modals', function () {
// do something...
});