JSFiddle - React, Tailwind, and code Playground
by htmlzengarden
JavaScript
$(function(){
popin('#pop');
});
var popin = function(selector){
var open = 'open';
var behaviours = function(){
$('#pop').on('click', function(){
close();
});
$('#close').on('click', function(){
close();
});
$(document).keyup(function(e){
if(e.keyCode == 27 && $(selector).is(':visible'))
{
close();
}
});
};
var close = function(){
$('#page').removeClass(open);
};
var init = function(){
behaviours();
};
init();
}