Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

If you're using Fancybox with dynamic image URLs, you may find that the gallery/full screen pop-up is not working. Instead of the pop-up, when clicked, the source image is being loaded in the window as if Fancybox wasn't initialised. This is because Fancybox hasn't been able to determine the image type so doesn't know what to do. It's easily rectified.

For example, URLs like this will cause this issue to surface: http://<some_domain>/image.php?id=1234

To allow these types of URLs to work, simply add this parameter to your Fancybox initialisation:
 Option
type: 'image'


For example, this is what my Fancybox initialisation looks like:
 JavaScript
$('.fancybox').fancybox({
padding: 6,
nextClick: true,
helpers: {
overlay: {
locked: false
}
},
type: 'image'
});


That's all there is to it!



-i

Hope you found this post useful...

...so please read on! I love writing articles that provide beneficial information, tips and examples to my readers. All information on my blog is provided free of charge and I encourage you to share it as you wish. There is a small favour I ask in return however - engage in comments below, provide feedback, and if you see mistakes let me know.

If you want to show additional support and help me pay for web hosting and domain name registration, donations, no matter how small, are always welcome!

Use of any information contained in this blog post/article is subject to this disclaimer.
comments powered by Disqus
Other posts you may like...