JSFiddle - React, Tailwind, and code Playground
by slackero
HTML
<script src="http://fancyapps.com/fancybox/source/jquery.fancybox.js"></script>
<link rel="stylesheet" href="http://fancyapps.com/fancybox/source/jquery.fancybox.css">
<div class="fancy">
<a rel="gallery" class="fancybox" href="http://fancyapps.com/fancybox/demo/1_b.jpg"><img src="http://fancyapps.com/fancybox/demo/1_s.jpg" alt=""/></a>
<a rel="gallery" class="fancybox" href="http://fancyapps.com/fancybox/demo/2_b.jpg"><img src="http://fancyapps.com/fancybox/demo/2_s.jpg" alt=""/></a>
<a rel="gallery" class="fancybox" href="http://fancyapps.com/fancybox/demo/3_b.jpg"><img src="http://fancyapps.com/fancybox/demo/3_s.jpg" alt=""/></a>
</div>
<div id="showme">
Hey Cool
<span class="close">x</span>
</div>
CSS
body {
position: relative;
padding: 20px;
font-size: 16px;
font-family: sans-serif;
}
.fancy {
position: relative;
z-index: 1;
}
#showme {
position: absolute;
display: none;
width: 300px;
background-color: #ccc;
border-radius: 10px;
padding: 20px;
text-align: center;
font-size: 18px;
font-weight: bold;
z-index: 10;
left: 100px;
top: 100px;
}
#showme span.close {
content 'x';
position: absolute;
font-size: 12px;
position: absolute;
right: 10px;
top: 10px;
cursor: pointer;
line-height: 12px;
}
JavaScript
var $showMe = $('#showme');
$(".fancybox").fancybox({
loop : false,
beforeLoad: function() {
$showMe.hide();
},
afterClose: function(current, previous) {
$showMe.fadeIn();
}
});
$showMe.click(function() {
$showMe.fadeOut();
});