如何使用Zurb基金会显示打开,打开,关闭,关闭回调函数? [英] How to use Zurb Foundation reveal with open, opened, close, closed callback functions?

查看:206
本文介绍了如何使用Zurb基金会显示打开,打开,关闭,关闭回调函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在zurb foundation的网站 http://foundation.zurb.com/docs/reveal.php 上列出了一些选项,包括



open:回调函数,用于触发模式打开之前的



close:回调函数,触发'before'模态准备关闭。



closed:回调函数,触发'after'模态关闭后。



但我不知道如何使用它们与我的模态。
Itried



$('#myModal')。closed(function()
{});



$('#myModal')。trigger('reveal:closed')(
{});



$('#myModal')。reveal.closed(function()
{}) ;



$('#myModal')。 {});



我已经google了,但没有找到匹配。任何人可以解释它,或给我一个例子或提供一个相关的链接?



谢谢!它的工作原理!



我还有另一个紧密相关的问题为reveal()



< a href =#class =buttondata-reveal-id =myModal2> Click Me For A Modal< / a>);



我试图添加一个属性,如 data-closeOnBackgroundClick =false这似乎不工作。应该是正确的语法?它将工作回调函数吗?

解决方案

像往常一样调用显示选项和相应的函数作为一个对象:

  //显示模态并在关闭时说Good bye
$(#myModal)。reveal({closed:function(){alert(Good bye)}});


On zurb foundation's website at http://foundation.zurb.com/docs/reveal.php they listed some Options including

open: callback function that triggers 'before' the modal opens.

opened: callback function that triggers 'after' the modal is opened.

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. Itried

$('#myModal').closed(function() {});

$('#myModal').trigger('reveal:closed')( {});

$('#myModal').reveal.closed(function() {});

$('#myModal').reveal().closed(function() {});

I have googled but found no hits. Anyone who can explain it or give me an example or provide a related link?

Thank you! It works!

I have yet another closely related question for reveal()

<a href="#" class="button" data-reveal-id="myModal2">Click Me For A Modal</a>);

I tried to add one attribute like data-closeOnBackgroundClick="false" That doen't seem to work. What should be the correct syntax? Will it work for callback function as well?

解决方案

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基金会显示打开,打开,关闭,关闭回调函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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