如何使用Zurb Foundation透露开放,打开,关闭,关闭回调函数? [英] How to use Zurb Foundation reveal with open, opened, close, closed callback functions?

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

问题描述

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



open:回调函数,触发之前模态打开。



打开:回调函数触发'后'模式打开。



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



关闭:回调函数触发之后模态关闭。



但是我不知道如何使用它们我的模态
表示



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



$('#myModal')触发器('显示:关闭')(
{});



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



我已经google了,但没有发现点击。任何人谁可以解释或给我一个例子或提供相关链接?



谢谢!它有效!



我还有另一个密切相关的问题,显示()



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



我尝试添加一个属性,如 data-closeOnBackgroundClick =false这似乎不起作用。什么是正确的语法?它可以用于回调函数吗?

解决方案

呼叫像你通常会显示,但包括该选项和相应的函数作为一个对象:

  //显示模态,并在关闭$ b $时说再见 b $(#myModal)。显示({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 Foundation透露开放,打开,关闭,关闭回调函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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