Copyright © 2010 Tom Coote. All Rights Reserved. Powered by WordPress themed by bavotasan.com.
Sometimes all you need is the simplest kind of functionality to get a job done. I was working on a project recently and needed a no frills pop up to show another document. What I realised is all the modal type scripts I have or had seen on the internet all came with added extra’s that I just didn’t want to mess around with, so I created a simple modal script.
You can check out the demo pageĀ here. It requires jQuery on the page for it to work. The following script is an example of how to open a window;
SimpleModal.open('demo1.html', 500, 600);
Here is the script to close a modal;
SimpleModal.close();
The modal windows are always closed in last in first out order.
Update: I have added the ability to specify a callback function. So if the callback is specified then when that modal has been closed the function gets invoked.
SimpleModal.open('demo1.html', 500, 600, function() {
alert('This is a callback function');
});
Tested to work in the following browsers;
- IE 7 & 6
- FireFox 3.0.1
- Opera 9.51
- Chrome
- Safari for windows

