FancyZoom meet jQuery
A few days ago John posted a rewritten version of Cabel Sasser’s FancyZoom to work with Prototype and Scriptaculous. I took it upon myself to port it to jQuery, while making a few usability improvements.
FIrst off, you can visit the demo to see the effect in action. It’s nearly identical in behavior to John’s original in Prototype. But the fancyZoom effect is added in a much more jQuery-like way.
$(document).ready(function() { $('a.zoom').fancyZoom(); });
This will add the Zoom Effect to any a
tag classed with zoom
, and will show content relating to the id
referenced in the href
of the a
tag.
Additions, etc.
I’ve added in a few additional usability enhancements, most of which John has included back into the Prototype version. These include:
- The zoom will close when clicking outside the zoom box area.
- Hitting the
esc
key will close the zoom window. - Passing an option of
closeOnClick: true
into thefancyZoom
function will close the zoom when the contents are clicked as well. This works great for image galleries.
So enjoy, all you jQuery folks. Both jQuery and Prototype versions are kept in the same repository, so you can get the code and see examples at GitHub.