Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
65
rated 0 times [  72] [ 7]  / answers: 1 / hits: 16001  / 11 Years ago, tue, march 26, 2013, 12:00:00

My javascript syntax is rookie-level, but I'm learning :>



I'm using Fancybox 2.1.4 to reveal an inline <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.



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



So I need to keep <div id=content> from disappearing after closing the fancybox (which it natively disappears).



After some research, I found that using the afterClose callback, I can simply change or add the inline style of idcontent to display:block (which solves the problem.



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?



<script type=text/javascript>
$(document).ready(function() {
$(.fancybox).fancybox(
);
});
</script>


Thanks very much for any assist


More From » jquery

 Answers
83

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>

[#79334] Tuesday, March 26, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rayvenc

Total Points: 666
Total Questions: 125
Total Answers: 99

Location: Northern Ireland
Member since Mon, Nov 14, 2022
2 Years ago
;