Dynamic population of jQueryTools Overlay
triggering an overlay load from within the overlay itself.
HTML
<script src="http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script>
<div class="modal" id="alert">
<article>
<h2>ALERT!</h2>
<p>Alert text.</p>
</article>
<button class="close">CLOSE</button>
<button class="alt">ALT</button>
</div>
CSS
.modal {
display:none;
z-index:10000;
background-color:#e5e5e5;
width:400px;
padding:0 5px 10px;
border:1px solid #333;
text-align:center;
}
.close, .alt {
width:90%;
margin:0 auto;
}
JavaScript
$('#alert').overlay({
mask: {
color : '#666',
loadSpeed : 200,
opacity : 0.9
},
closeOnClick : false,
load : false,
onLoad : function() {
OL_obj = this;
this.getOverlay().find(".alt").click(function() {
OL_obj.close();
});
}
});
$("body").append("<button id='show'>Trigger</button>");
$("#show").click(function() {
$("#alert").data("overlay").load();
});