如何在加载任何 NyroModal 对话框时执行一些 Javascript 代码
我有一些常见的 Javascript,我想在打开任何 NyroModal 对话框时执行它们。
如何为 NyroModal 组件的“加载”(或其他)事件分配事件处理程序?
I have some common Javascript which I would like to execute on the event of any NyroModal dialog being opened.
How do I assign an event handler for, say, the 'on load' (or whatever) event of the NyroModal component?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须在回调设置中设置 afterShowCont,例如:
或者,您可以在自定义过滤器中定义它,例如:
或者您可以在启动 nyroModal 元素时定义它:
NB:所有这些解决方案与 nyroModal V2 一起使用。
You have to set the afterShowCont inside a callbacks settingslike:
Or, you can define it in the custum filter like:
Or you can define it when you're initiating the nyroModal elements:
NB : all of these solutions work with nyroModal V2.
NyroModal 的所有事件处理程序都可以在其“选项”对象中设置,您可以使用“$.nmObj”函数进行设置(通过传递包含要设置的键/值的对象)。
要处理弹出窗口的加载,您可能需要“afterShowCont”处理程序:
请在此处查看完整的事件列表:http://nyromodal.nyrodev.com/#filters
注意:“nm”参数将包含 NyroModal 对象的实例,它允许您更改内容、操作 NyroModal 等。
All of the NyroModal's event handlers can be set in its 'options' object, which you can set using the '$.nmObj' function (by passing an object containing the keys/values you want to set).
To handle the on-load of a popup, you probably want the 'afterShowCont' handler:
See a full list of events here: http://nyromodal.nyrodev.com/#filters
Note: The 'nm' parameter will contain an instance of the NyroModal object, which allows you to alter the content, manipulate the NyroModal, etc.