$(document).ready(function() {
$("#modal").hide();
var rebuildContainer = function() {
$("#container").html("<button class='modalLaunch' rel='#modal'>Contained launch button 1</button><br><button class='modalLaunch' rel='#modal'>Contained launch button 2</button>");
var triggers = $(".modalLaunch").overlay({
mask: {
color: '#bbbbee',
loadSpeed: 200,
opacity: 0.9
},
closeOnClick: true,
load: false
});
}
$("#rebuildContainer").click(function() {
console.log("rebuilding buttons inside the container div");
$(".modalLaunch").each(function() {
var o = $(this).overlay();
if (o) {
console.log("there is an overlay associated with this button");
if (o.isOpened()) {
// I would expect this to be true once each time the handler is called
console.log("the overlay associated with this button is open");
}
}
});
$(".modalLaunch").overlay().close();
rebuildContainer();
});
rebuildContainer();
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.