Saturday, June 11, 2011

How to close a JQuery modal on overlay click?

PROBLEM:
How to close a JQuery modal popup when the user clicks outside the div, on the darkened overlay?

SOLUTION:

jQuery(function ($) {
   $('.simplemodal-overlay').live("click", function () {
       $.modal.close();
   }); 
});

SOURCE:
http://www.ericmmartin.com/projects/simplemodal/