-2

我有一个显示模态,模态内有一个表单,当用户提交我希望模态关闭的表单时。

有人可以帮我写代码吗?

http://zurb.com/playground/reveal-modal-plugin

我尝试将“dismissmodalclass”更改为提交按钮的类

$('#modal').reveal({
     animation: 'fadeAndPop',                   //fade, fadeAndPop, none
     animationspeed: 300,                       //how fast animtions are
     closeonbackgroundclick: true,              //if you click background will modal close?
     dismissmodalclass: 'close-reveal-modal'    //the class of a button or element that will close an open modal
});
4

1 回答 1

0

我正在接受它,因为这被标记为基金会,你正在使用基金会的揭示

在这种情况下,我建议您实际阅读文档,如果您这样做了,您会知道可以通过 javascript 触发(打开或关闭)模型

** 使用 java 触发模式的示例 - Cookie 警告**

在您的结束正文标记之前,包含用于foundation.js :

<script>
$(function() {
    var COOKIE_NAME = 'welcome_cookie';
    $go = $.cookie(COOKIE_NAME);
    if ($go == null) {
        $.cookie(COOKIE_NAME, 'This Cookie is used to remember that you have seen our cookie policy', {path: '/', expires: 6});
        $('#myModal').foundation('reveal', 'open');
    }
    else {
    }
});
</script>

模态:

<div id="myModal" class="reveal-modal small" data-reveal>
<h2>This Site Uses Cookies.</h2>
<p class="lead">Cookie Policy.</p>
<p>To give you the best experience, this site uses cookies, By continuing to use this website you are giving consent to cookies being used. For information on cookies and how you can disable them visit <a href="">here</a></p>
<a class="close-reveal-modal">&#215;</a>

这是一个模态的示例,如果欢迎 cookie 不存在,则会弹出但我确定您需要的只是

 $('#myFormModel').foundation('reveal', 'close');

还要检查文档中的事件绑定

Zurb 基金会 | 文档 | 揭示

于 2014-10-08T23:28:31.053 回答