Download
User Rating: 0/5 ( 0 votes)
Simple Modal is a small plugin to create modal windows. It can be used to generate alert or confirm messages with few lines of code. Confirm configuration involves the use of callbacks to be applied to affirmative action; it can work in asynchronous mode and retrieve content from external pages or getting the inline content.SIMPLEMODAL is not a lightbox although the possibility to hide parts of its layout may partially make it similar.
1. INCLUDE JS FILES
<script type="text/javascript" language="javascript" src="jQuery.js"></script>
<script type="text/javascript" language="javascript" src="simple-modal.js"></script>
2, HTML
<a id="myElement" href="javascript;">Open Modal</a>
3. EXAMPLES
SIMPLEMODAL is very simple to use; here are 4 ways to create SIMPLEMODAL: simple alert message, modal window, modal window with a single asynchronous call and lightbox.
ALERT INTEGRATION
$("myElement").addEvent("click", function(){
var SM = new SimpleModal({"btn_ok":"Alert button"});
SM.show({
"title":"Title",
"contents":"Your message..."
});
});
MODAL INTEGRATION
$("myElement").addEvent("click", function(){
var SM = new SimpleModal({"width":600});
SM.addButton("Action button", "btn primary", function(){
this.hide();
});
SM.addButton("Cancel", "btn");
SM.show({
"model":"modal-ajax",
"title":"Title",
"param":{
"url":"file-content.php",
"onRequestComplete": function(){ /* Action on request complete */ }
}
});
});
MODAL-AJAX INTEGRATION
$("myElement").addEvent("click", function(){
var SM = new SimpleModal({"width":600});
SM.addButton("Action button", "btn primary", function(){
this.hide();
});
SM.addButton("Cancel", "btn");
SM.show({
"model":"modal-ajax",
"title":"Title",
"param":{
"url":"ajax-content.php",
"onRequestComplete": function(){ /* Action on request complete */ }
}
});
});
MODAL-IMAGE
$("myElement").addEvent("click", function(){
var SM = new SimpleModal();
SM.show({
"model":"modal-ajax",
"title":"Image title",
"param":{
"url":"http://url-file.jpg",
"onRequestComplete": function(){ }
}
});
});