Currently, I am experimenting with utilizing the beforeLoad
and afterClose
features in Fancybox 2 to achieve a specific goal.
The objective is to conceal a flash animation within an iFrame - nested inside the #elanceiframe
div - while Fancybox is active and displaying a portfolio. Upon closing Fancybox, the intention is to reveal the hidden div once again.
This action is necessary because the iFrame does not adhere to z-index properties in Internet Explorer and remains visible alongside Fancybox images instead of being faded out. To address this issue, I aim to set the #elanceiframe
div's display property to 'none' while Fancybox is operational.
Despite defining the fancybox initialization function successfully for the portfolio display, there seems to be an issue with the execution of the beforeLoad
and afterClose
functions.
$(document).ready(function() {
$("a[data-fancybox-group=portfolio]").fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none',
'overlayColor' : '#000',
'overlayOpacity' : 0.7,
'beforeLoad' : function(){
$("#elanceiframe").css('display', 'none');
},
'afterClose': function() {
$("#elanceiframe").css('display','block');
}
});
});
Could someone verify if I am correctly utilizing the beforeLoad
and afterclose
functionalities?
Is it mandatory to apply CSS styling on the #elanceiframe
div initially, such as using display:none
?
Edit 12/04/13
Fortunately, the aforementioned example is functioning properly; it appears that my mistake was referencing the incorrect div
within the function :(