莫代尔关闭的基金会火灾事件?

Joe*_*tto 3 javascript jquery zurb-foundation zurb-foundation-6

我在我的应用程序中使用基础显示通过AJAX发送信息.一切正常,但在模态结束时我想改变一些文字.当模态与Foundation 6关闭时,如何触发函数?任何帮助都会很棒,我目前的代码如下:

$("#share_modal").foundation('reveal', 'close', function() {
    alert("closed");
});
Run Code Online (Sandbox Code Playgroud)

我收到了错误

未捕获的ReferenceError:很抱歉,'reveal'不是此元素的可用方法.

但我所指的元素是 .reveal

<div class="reveal" id="share_modal" data-reveal data-options="closeOnClick:true; closeOnEsc: true;">
    <div class="row">
Run Code Online (Sandbox Code Playgroud)

Gav*_*uce 6

在Foundation 6中,活动有点不同.

(function ($, window, undefined) {
  'use strict';

  $('[data-reveal]').on('closed.zf.reveal', function () {
    var modal = $(this);
    alert('closed');
  });

  $(document).foundation();


})(jQuery, this);
Run Code Online (Sandbox Code Playgroud)

这将针对所有的揭示.如果您只想定位#share_modal,请将选择器更改为$('[data-reveal]'),$('#share_modal') 或者您可以使用它modal.id来检查元素ID.它可能是modal.attr('id')

参考:http://foundation.zurb.com/sites/docs/reveal.html#js-events