I'm using the Fancybox plugin for my modal windows. It seems like no matter what options I use I can't prevent the fancybox modal window from closing when the user clicks outside of the fancybox modal window (grayed out area).
Is there a way to force the user to click the X or a button that I trigger the close event? This seems like it should be simple so I'm hoping I'm just reading the examples wrong.
I've tried hideOnContentClick: false
but that doesn't seem to be working for me. Any ideas?
The
$("#fancybox-overlay").unbind()
solution given for this question by @Gabriel works except I needed to bind it to the fancybox after it loads its content, and I couldn't unbind immediately. For anyone who runs into this issue, the following code solved the problem for me:The 400ms delay got it working for me. It worked with 300ms but I didn't want to take chances.
Set the
closeClick
parameter to false inside your function: