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 显示打开、打开、关闭、关闭回调函数?


基础教程推荐
- 我可以在浏览器中与Babel一起使用ES模块,而不捆绑我的代码吗? 2022-01-01
- html表格如何通过更改悬停边框来突出显示列? 2022-01-01
- 如何使用JIT在顺风css中使用布局变体? 2022-01-01
- 直接将值设置为滑块 2022-01-01
- 用于 Twitter 小部件宽度的 HTML/CSS 2022-01-01
- Chart.js 在线性图表上拖动点 2022-01-01
- 如何使用TypeScrip将固定承诺数组中的项设置为可选 2022-01-01
- Vue 3 – <过渡>渲染不能动画的非元素根节点 2022-01-01
- Electron 将 Node.js 和 Chromium 上下文结合起来意味着 2022-01-01
- 自定义 XMLHttpRequest.prototype.open 2022-01-01