I'm trying to use fancyBox and I wonder why when I close the fancyBox window, my element gets a "display:none;" style. Is there any solution to avoid this ?
My html file includes :
<script type="text/javascript" src="../js/jquery.fancybox.pack.js"></script>
<link rel="stylesheet" href="../css/jquery.fancybox.css" type="text/css" media="screen" />
The target element is this:
<div id="cadre" class="planche"><a id="inline" href="#photo"><img src="../img/new/img/1_ADELE_HAENEL_Actress-H.jpg" alt="ADELE HAENEL" id="photo"></a></div>
My Fancybox js is:
$(document).ready(function() {
/* This is basic - uses default settings */
$("a#single_image").fancybox();
/* Using custom settings */
$("a#inline").fancybox({
'hideOnContentClick': false
});
/* Apply fancybox to multiple items */
$("a.group").fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'speedIn' : 600,
'speedOut' : 200,
'overlayShow' : false
});
});
jQuery(document). ready(function($) { $('button'). on('click', function() { $. fancybox(); }); });
FancyBox is a tool for displaying images, html content and multi-media in a Mac-style "lightbox" that floats overtop of web page. It was built using the jQuery library.
I had the same problem and the solution was to to populate the href attribute of the a element with a valid href
Add a valid href tag to the a element. Below is a simple example for the same. I faced the same issue and fixed with that.
<a class="fancybox" href="http://fancyapps.com/fancybox/demo/1_b.jpg"><img src="http://fancyapps.com/fancybox/demo/1_s.jpg" alt=""/></a>
Then call the fancybox.
$(".fancybox").fancybox({});
JsFiddle demo example
http://jsfiddle.net/FM82s/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With