I have a FancyBox 2.1.5 and it's using overlay "closeClick: true", meaning that FancyBox will close when the overlay is clicked anywhere. I'm updating the FancyBox content dynamically in various ways and would like to be able to change the overlay closeClick behaviour to "false" in a certain scenario.
Is there a way to update FancyBox options dynamically in this way? This change in behavior would not be relatable to any of the ready events/callbacks but would be user-initiated.
Unfortunately you cannot change the
closeClick
behavior of the current fancybox once it has been opened; you could only evaluate a condition within thebeforeLoad
orafterLoad
callbacks and change the API options usingjQuery.extend()
though.However, as a workaround, you could simulate the API settings and catch
click
events on the overlay to decide whether to close fancybox or not for user-initiated changes soSee JSFIDDLE