Javascript Valujs基础模态事件冻结浏览器 我给我的流星网加上地基4。我用这个包裹 https://atmosphere.meteor.com/package/foundation 我遵循基础主页上的步骤 令人惊叹的。我有。 您的沙发。它是我的

Javascript Valujs基础模态事件冻结浏览器 我给我的流星网加上地基4。我用这个包裹 https://atmosphere.meteor.com/package/foundation 我遵循基础主页上的步骤 令人惊叹的。我有。 您的沙发。它是我的,javascript,meteor,modal-dialog,zurb-foundation,Javascript,Meteor,Modal Dialog,Zurb Foundation,我是一个很酷的段落,生活在一个更酷的模式里面。获胜 模式正确打开,但当我尝试关闭模式时,浏览器被冻结。我测试了在模式中添加其他事件,比如只做控制台日志的链接,并且也被冻结。看起来我不能在模式中使用事件。。。有没有关于如何关闭模式并向其添加事件的想法 thx您是否尝试过将模式放入模板中 <head> <title>foundation</title> </head> <body> {{> foundation}} <

我是一个很酷的段落,生活在一个更酷的模式里面。获胜

模式正确打开,但当我尝试关闭模式时,浏览器被冻结。我测试了在模式中添加其他事件,比如只做控制台日志的链接,并且也被冻结。看起来我不能在模式中使用事件。。。有没有关于如何关闭模式并向其添加事件的想法


thx

您是否尝试过将模式放入模板中

<head>
  <title>foundation</title>
</head>

<body>
  {{> foundation}}
</body>

<template name="foundation">
  <h1>Hello World!</h1>

    <div id="myModal" class="reveal-modal">
        <h2>Awesome. I have it.</h2>
        <p class="lead">Your couch.  It is mine.</p>
        <p>Im a cool paragraph that lives inside of an even cooler modal. Wins</p>
        <a class="close-reveal-modal">&#215;</a>
    </div>

    <a href="#" data-reveal-id="myModal" class="open radius button">Example Modal…</a>
</template>
警告字,如果你的“显示模式”不直接插入标签下,那么元素在显示之前的基础将意味着流星事件不会被绑定到它。所以,确保将模态元素定义为标记的第一个子元素,以避免出现问题。
<a href="#" data-reveal-id="myModal" class="open radius button">Example Modal…</a>
<head>
  <title>foundation</title>
</head>

<body>
  {{> foundation}}
</body>

<template name="foundation">
  <h1>Hello World!</h1>

    <div id="myModal" class="reveal-modal">
        <h2>Awesome. I have it.</h2>
        <p class="lead">Your couch.  It is mine.</p>
        <p>Im a cool paragraph that lives inside of an even cooler modal. Wins</p>
        <a class="close-reveal-modal">&#215;</a>
    </div>

    <a href="#" data-reveal-id="myModal" class="open radius button">Example Modal…</a>
</template>
// foundation.js - foundation is the name of my meteor project
// so this is the default file added to my project
if (Meteor.isClient) {

  Template.foundation.events({
    "click h2": function(e) {
      console.log("modal h2 clicked");
    }
  });

  Template.foundation.rendered = function() {
    // you can bind custom events here if you need to
  }
}


if (Meteor.isServer) {
  Meteor.startup(function () {
    // code to run on server at startup
  });
}