Page 1 of 1

when fancyBox is closed, another div should fadeIn [solved]

Posted: Sat 8. Mar 2014, 10:46
by macangelo
Hi

I want to write a function that detects when the fancyBox is closed and then fades-in a div container with the id "xyz".

I tried this, but it doesn't work. Can anybody help?

$(document).ready(function(){
$(window).bind("beforeunload",
function() {
$("div#xyz").fadeIn("slow");
});
});
thanks a lot

macangelo

Re: when fancyBox is closed, another div should fadeIn

Posted: Sat 8. Mar 2014, 11:47
by Oliver Georgi
That is the wrong way. Have a look: http://jsfiddle.net/slackero/d6TeL/4/

If you use the phpwcms-fancyBox you have to implement this to jquery.fancybox.initSwipeOn.js or jquery.fancybox.initSwipeOff.js

Re: when fancyBox is closed, another div should fadeIn

Posted: Sat 8. Mar 2014, 18:40
by macangelo
Hi

Thanks a lot. It works fine! Here's the complete code I put in the html-content part (if my client approves I'll later put the frontend view here):

Code: Select all

<!-- JS: $(document).ready(function() {
        var $showMe = $('#aktuelleAngebote');
	$(".various").fancybox({
		maxWidth	        : 850,
		maxHeight  	: 700,
		fitToView	        : false,
		width		: '70%',
		height		: '70%',
		autoSize	        : false,
		closeClick	        : false,
		openEffect	: 'none',
		closeEffect	: 'none',
                loop                  : false,
                beforeLoad       : function() {
		                               $showMe.fadeOut('fast');
                                         },
                afterClose         : function(current, previous) {
                                                $showMe.fadeIn('slow');
                                          }
         });
});