Im new to JQuery and using simplemodal plugin.
I want to close my modal window when I click on overlay/body.
Here's the code I have so far
var contentObj = {onOpen: function (dialog) {
dialog.overlay.fadeIn('slow', function () {
dialog.data.hide();
dialog.container.fadeIn('slow', function () {
dialog.data.slideDown('slow');
return false;
});
});
}};
jQuery(function ($) {
$('.link').click(function (e) {
$('.content').modal(contentObj);
});
$('.content').modal({overlayClose:true});
});
Now, when I reload my website the modal window launches automatically, without clicking the link.
This happens because of my 'overlayClose' line is at the wrong place.
So how can I modify this code to get the overlayClose to work properly to close my content?