What I’m trying to achieve is to activate the Swinxyzoom WordPress plugin (which uses jQuery to allow the user to zoom into a part of an image) within a Fancybox lightbox on a responsive website.
After getting in contact with the Swinxyzoom plugin author, he sugested the following:
To integrate SwinxyZoom with a lightbox you will need to create some
custom code which is triggered when the lightbox has finished
displaying its content, eg. in fancybox this event is âonCompleteâ.At this point you need to wrap the content image of the lightbox with
an anchor tag targeting the large full image and then initialise
swinxyzoom as $(element).swinxyzoom();
Any help would be much appreciated!
The test page of the site on which I’ve used both of the above plugins individually is http://www.mcemcourses.org/radiology-test
Based on the information you have provided, this code should do the trick :
Notice that you will need 3 images :
href
of the link that opens fancybox, and actually, the image opened in fancybox.href
of the wrapping anchor inside theonComplete
callback.Also notice that the selector
#fancybox-img
refers to the opened image in fancybox for v1.3.x only.NOTE : Most popular fancybox WordPress plugins use v1.3.4.
See JSFIDDLE