显示Jquery模态关闭

时间:2014-10-03 08:49:56

标签: javascript jquery modal-dialog zurb-foundation zurb-reveal

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

有人可以帮我解决这个问题吗?

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
});

1 个答案:

答案 0 :(得分:0)

我正在服用它,因为这是标记基金会,你正在使用基金会的揭示

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

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

在您关闭body标签之前使用include for 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');

同时检查文档中的EVENT BINDINGS

Zurb Foundations | Docs | Reveal