基础模式在使用 .close 按钮后无法打开

foundation modal doesn't open after using the .close button

本文关键字:按钮 close 模式      更新时间:2023-09-26

我在基础模态方面遇到了问题,我用这个函数打开模态:

function bindAutoRevel() {
  $('div[data-auto-reveal]').foundation('reveal', 'open');
}

但是在使用默认的"关闭-显示-模式"链接关闭它后,如果我单击触发打开操作的链接,它不会再次打开。所以现在我为解决这个问题所做的是这样的:

$('#create-project-btn').click(function() {
  $('#project-modal').foundation('reveal', 'open');
});

但这应该是避免这种情况的一种方式。谢谢

你用过吗?

基础模态

因为上次当我使用基础模态时,我不必编写任何 JavaScript 代码来打开和关闭模态。我所有的代码都是:

    <a data-toggle="exampleModal1" class="button large button plus">+</a>
<div class="reveal league-reaveal" id="exampleModal1" data-reveal>
        //some html code
        <button class="close-button success" data-close aria-label="Close reveal" type="button">
            <span aria-hidden="true">&times;</span>
        </button>
</div>

这需要包括:

    <script src="~/Scripts/jquery-1.10.2.js"></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/foundation/6.0.5/foundation.min.css">
    <script src="https://cdn.jsdelivr.net/foundation/6.0.5/foundation.min.js"></script>
    <script src="jquery.reveal.js" type="text/javascript"></script>

这是javascript代码:

<script type="text/javascript">
        $(document).ready(function () {
        $(document).foundation();
    });
</script>