Unpublished modal using Zurb Foundation

I use the Zurb Foundation on the site, and I tried to get a modal window working with the Reveal JS plugin. I see that you can add the dismissModalClass parameter to the parameters that you pass to reveal() , which attach the event handler to the button, etc., which close the modal click.

Is there a way to manually close a modal window using Reveal? I would like to be able to apply the close method to various user events.

+8
jquery zurb-foundation modal-dialog
source share
3 answers

You can simply trigger a dynamic click in another event by doing something like this

 $('.close-reveal-modal','#myModal').click() 

UPDATE

After looking at the source code of the plugin, it looks like they are associating an event with the reveal:close modal element. So you can also do something like this

 $('.otherClose').click(function(){ $('#myModal').trigger('reveal:close') })​ 

Here is the fiddle

+22
source share

You can also use the following:

 $('#myModal').foundation('reveal', 'close'); 
+10
source share

You can use your jquery plugin jquery.foundation.reveal.js

  $('#mymModal').reveal({ dismissmodalclass: 'close-reveal-modal' //class name of button to close open dialog } }); 
0
source share

All Articles