How to use Zurb Foundation reveal with open, opened, close, closed callback functions?(如何使用 Zurb Foundation 显示打开、打开、关闭、关闭回调函数?)
问题描述
在 zurb 基金会的网站 http://foundation.zurb.com/docs/reveal.php 他们列出了一些选项,包括
On zurb foundation's website at http://foundation.zurb.com/docs/reveal.php they listed some Options including
open:在模式打开之前触发的回调函数.
open: callback function that triggers 'before' the modal opens.
opened:在模态打开后触发的回调函数.
opened: callback function that triggers 'after' the modal is opened.
close:在模式准备关闭之前触发回调函数.
close: callback function that triggers 'before' the modal prepares to close.
关闭:在模式关闭后触发的回调函数.
closed: callback function that triggers 'after' the modal is closed.
但我不知道如何将它们与我的模态一起使用.我试过了:
But I have no idea how to use them with my modal. I tried:
$('#myModal').closed(function()
{});
$('#myModal').trigger('reveal:closed')(
{});
$('#myModal').reveal.closed(function()
{});
$('#myModal').reveal().closed(function()
{});
我在 Google 上搜索过,但没有找到任何匹配结果.任何人都可以解释它或给我一个例子或提供相关链接?
I have Googled but found no hits. Anyone who can explain it or give me an example or provide a related link?
但是,给出的建议有效对于 reveal(),我还有另一个密切相关的问题:
The suggestion given works, however
I have yet another closely related question for reveal():
<a href="#" class="button" data-reveal-id="myModal2">Click Me For A Modal</a>);
我尝试添加一个属性,例如 data-closeOnBackgroundClick="false" 这似乎不起作用.正确的语法应该是什么?它也适用于回调函数吗?
I tried to add one attribute like data-closeOnBackgroundClick="false" That doesn't seem to work. What should be the correct syntax? Will it work for callback function as well?
推荐答案
像往常一样调用 reveal,但将选项名称和对应函数作为对象包含:
Call reveal like you normally would, but include the name of the option and corresponding function as an object:
//Reveal the modal and say "Good bye" when it closes
$("#myModal").reveal({ "closed": function () { alert("Good bye") } });
这篇关于如何使用 Zurb Foundation 显示打开、打开、关闭、关闭回调函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 Zurb Foundation 显示打开、打开、关闭、关闭回调函数?
基础教程推荐
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
