如何检测Materialized.js模态关闭事件? [英] How to detect Materialized.js modal closing event?

查看:89
本文介绍了如何检测Materialized.js模态关闭事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检测materialized.js的关闭事件?

当模式关闭时,我想运行一些JavaScript代码,方法是单击模式关闭按钮或按转义按钮或单击屏幕的任何其他区域.

I want to run some JavaScript code when the modal got closed either by clicking on modal close button or pressing escape button or clicking on any other area of the screen.

推荐答案

看起来像您的意思是 materializecss 框架的 modal 的关闭事件.

Looks like you mean closing event for modal of the materializecss framework.

针对0.97.1版本(2015年9月15日),打开模式时,您可以传递选项(请参阅: http: //materializecss.com/modals.html#options ),但请注意,这是一个非常容易引起误解的描述,因为在使用lean_modal(

As for 0.97.1 version (15th of September, 2015) When opening a modal, you can pass options (see: http://materializecss.com/modals.html#options), but note, that it's a very delusive description, as the options are not being saved when using lean_modal (https://github.com/Dogfalo/materialize/issues/1464), so they should be passed only to openModal.

总结:

var onModalHide = function() {
    alert("Modal closed!");
};

$("#id-of-your-modal").openModal({
    complete : onModalHide
});

这篇关于如何检测Materialized.js模态关闭事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆