ericmmartin / simplemodal

A modal dialog framework for jQuery
http://simplemodal.com/
Other
506 stars 229 forks source link

onClose callback cannot be cancelled out of. #65

Open davidemerritt opened 8 years ago

davidemerritt commented 8 years ago

it seems that that you cannot cancel out of the onClose callback with any combination of return false/stopPropogation because s.unbindEvents is being called (line 675) before the callback is run.

A simple proposal that wouldn't change existing behavior is the to move unbindEvents inside the if blocks for callback/non-callback closing, continue always calling it in the case of no callback, and call it unless the callback returns false when inside the callback branch of that if statement. If this seems reasonable, I'll make a PR.