O'Reilly logo

Instant Fancybox by Kyle Diedrick

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Listening for Fancybox events (Advanced)

Fancybox provides us with a number of different event-driven callback functions that allow us to run code when a certain event occurs. The main callback functions we can use allow us to run code when Fancybox is about to display or hide, when content is about to be loaded or after it is done loading, and when the user plays or pauses the slideshow. We are only going to look at triggering functionality when Fancybox opens and closes and on play/pause. At the end of this recipe is a list of all of the callback functions available in Fancybox.

Getting ready

Let's expand upon the code that we used in the previous recipe. Right now the bar with our links shows all the time regardless of whether or not Fancybox ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required