[英]Fancybox - Implementing afterClose callback
My javascript syntax is rookie-level, but I'm learning :> 我的javascript语法是新手级别,但我正在学习:>
I'm using Fancybox 2.1.4 to reveal an inline <div id="content">
. 我正在使用Fancybox 2.1.4来显示内联
<div id="content">
。 Traditionally, the <div>
would be set to style="display:none"
and Fancybox will change that to block when activated, and back to none
when closed. 传统上,
<div>
将设置为style="display:none"
,Fancybox将在激活时将其更改为阻止,并在关闭时返回为none
。
In my case, I actually have the content of that <div>
visible on the page in a different location (it's the right thing for the project, I know there are various opinions that can be had there). 在我的情况下,我实际上在页面上可以看到
<div>
的内容在不同的位置(这对项目是正确的,我知道可以有各种各样的意见)。
So I need to keep <div id="content">
from disappearing after closing the fancybox (which it natively disappears). 所以我需要保持
<div id="content">
在关闭fancybox后消失(它本身消失了)。
After some research, I found that using the afterClose
callback, I can simply change or add the inline style of id"content"
to display:block
(which solves the problem. 经过一些研究,我发现使用
afterClose
回调,我可以简单地改变或添加id"content"
的内联样式来display:block
(它解决了问题。
The problem... is my rookiness :> I tried for quite a long time and just not sure where to put the code, and the right syntax. 问题是...我的开玩笑:>我试了很长时间,只是不知道在哪里放置代码,以及正确的语法。
How would i add that afterClose
to my fancybox function? 我如何将
afterClose
添加到我的fancybox函数中?
<script type="text/javascript">
$(document).ready(function() {
$(".fancybox").fancybox(
);
});
</script>
Thanks very much for any assist 非常感谢任何帮助
This is the format : 这是格式:
<script type="text/javascript">
$(document).ready(function() {
$(".fancybox").fancybox({
afterClose : function(){
// here any javascript or jQuery to execute after close
}
}); // close fancybox
}); // close ready
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.