JSFiddle - React, Tailwind, and code Playground
by envira
HTML
<script src="http://dimsemenov-static.s3.amazonaws.com/dist/jquery.magnific-popup.min.js"></script>
<link rel="stylesheet" href="http://dimsemenov-static.s3.amazonaws.com/dist/magnific-popup.css">
<ul id="inline-popups">
<li><a href="#test-popup" data-effect="mfp-move-horizontal">Horizontal move</a></li>
</ul>
<div id="test-popup" class="white-popup mfp-with-anim mfp-hide">You may put any HTML here. This is dummy copy. It is not meant to be read. It has been placed here solely to demonstrate the look and feel of finished, typeset text. Only for show. He who searches for meaning here will be sorely disappointed.</div>
CSS
.mfp-move-horizontal {
/* start state */
/* animate in */
/* animate out */
}
.mfp-move-horizontal .mfp-with-anim {
opacity: 0;
transition: all 0.3s;
transform: translateX(-50px);
}
.mfp-move-horizontal.mfp-bg {
opacity: 0;
transition: all 0.3s;
}
.mfp-move-horizontal.mfp-ready .mfp-with-anim {
opacity: 1;
transform: translateX(0);
}
.mfp-move-horizontal.mfp-ready.mfp-bg {
opacity: 0.8;
}
.mfp-move-horizontal.mfp-removing .mfp-with-anim {
transform: translateX(50px);
opacity: 0;
}
.mfp-move-horizontal.mfp-removing.mfp-bg {
opacity: 0;
}
.white-popup {
position: relative;
background: #FFF;
padding: 25px;
width: auto;
max-width: 400px;
margin: 0 auto;
}
JavaScript
$('#inline-popups').magnificPopup({
delegate: 'a',
removalDelay: 500, //delay removal by X to allow out-animation
callbacks: {
beforeOpen: function() {
this.st.mainClass = this.st.el.attr('data-effect');
}
},
midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source.
});