JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://arshtepe.github.io/modal/modal-default.css">
<script src="http://arshtepe.github.io/modal/modal.min.js"></script>
<div id="modal-window" class="modal-window" >
<div id='modal-head' class="modal-head"><h2>Hello</h2></div>
<div id='modal-body' class="modal-body">I am modal window â„–2</div>
<div id='modal-footer' class = "modal-footer">
<span class='modal-button close-button'>Close me</span>
</div>
</div>
<input type="button" id="m" data-modal-id="modal-window-1" value="window">
CSS
/*------------------------
MODAL STYLE
*/
.modal-window {
display: none;
width: 300px;
background-color: white;
z-index: 100000;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #808080;
margin: 0;
color: #808080;
font-size: 13px;
font-weight: normal;
line-height: 18px;
background-color: #FFFFFF;
border: 1px solid #EAEEFA;
border: 1px solid rgba(234, 238, 250, 0.6);
-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
-moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
}
.modal-head {
padding: 5px 15px;
margin: 0;
}
.modal-head h2 {
text-align: center;
}
.modal-body {
padding: 40px;
font-size: 15px;
text-align: center;
border-top: 1px solid #EEEEEE;
-webkit-border-radius: 0 0 6px 6px;
-moz-border-radius: 0 0 6px 6px;
border-radius: 0 0 6px 6px;
-webkit-box-shadow: inset 0 1px 0 #FFF;
-moz-box-shadow: inset 0 1px 0 #FFF;
box-shadow: inset 0 1px 0 #FFF;
}
.modal-footer {
display: block;
background-color: #F5F5F5;
padding: 10px 11px 11px;
border-top: 1px solid #EEEEEE;
-webkit-border-radius: 0 0 6px 6px;
-moz-border-radius: 0 0 6px 6px;
border-radius: 0 0 6px 6px;
-webkit-box-shadow: inset 0 1px 0 #FFF;
-moz-box-shadow: inset 0 1px 0 #FFF;
box-shadow: inset 0 1px 0 #FFF;
zoom: 1;
margin-bottom: 0;
text-align: center;
cursor: pointer;
font-family:arial;
font-size: 15px;
}
JavaScript
var bt = document.getElementById( "m"),
win = document.getElementById( "modal-window" );
var modal = new ModalJS({
window: win,
opt_closeButtonCls: "modal-footer",
opt_isOverlayClickHide: true
})
bt.onclick = function ( ) {
modal.show();
};
modal.on( "showed", function ( ) {
console.log("showed" );
} );
modal.setStartAnimationPosition = function() {
this.window.style.top = 0 + "px";
};
modal.setEndAnimationPostition = function ( ) {
var win = this.window,
top = window.innerHeight - win.offsetHeight ,
left = ( window.innerWidth - win.offsetWidth ) / 2 ;
win.style.top = top + "px";
win.style.left = left + "px";
};