简体   繁体   中英

Zurb Foundation 6 - Close Modal using jQuery

I have a page created using Zurb Foundation 6. I have a modal set up and working correctly.

I am trying to close the modal when an element is clicked like this..

jQuery('#test').click(function(){
    jQuery('#exampleModal').foundation('reveal', 'close');
});

But this is giving me the following error message...

Uncaught ReferenceError: We're sorry, 'reveal' is not an available method for e.

Where am I going wrong?

Looks like you have too many parameters in the foundation() function. Here's the documentation for closing the Reveal modal. Try this:

jQuery('#test').click(function() {
    jQuery('#exampleModal').foundation('close');
});

Make sure #test is the ID of the element you're clicking to close, and #exampleModal is the ID of the Reveal modal.

尝试

$('#exampleModal').foundation('close');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM