I am using Zurb Foundation on a site, and I was trying to get a modal window working with the Reveal JS Plugin. I see that you can add a dismissModalClass
option to the parameters that you pass to reveal()
that will attach an event handler to a button, etc. that will close the modal on click.
Is there a way to manually close the modal window with Reveal? I would like to be able to attach a close method to different custom events.
You could simply trigger the click dynamically in an other event by doing something like this
$('.close-reveal-modal','#myModal').click()
UPDATE
After looking through the source code of the plugin, it looks like they bind an event to the modal element called reveal:close
. So you can also do something like this
$('.otherClose').click(function(){
$('#myModal').trigger('reveal:close')
})