Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Unreveal" modal using Zurb Foundation

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.

like image 728
Andrew Avatar asked Jul 11 '12 21:07

Andrew


2 Answers

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')
})​

Here is a fiddle

like image 183
Amin Eshaq Avatar answered Oct 21 '22 15:10

Amin Eshaq


You can also use the following:

$('#myModal').foundation('reveal', 'close');
like image 31
Pramod Avatar answered Oct 21 '22 15:10

Pramod