Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>what I'm after is when the &lt;a id="manual1"&gt; is clicked the example-large is displayed in fancybox - the viewed example-large.jpg can then be clicked to go to a new page </code></pre> <p>Another simpler and cleaner approach, based on your code (the fancybox manual method) is to add a custom <strong>link</strong> option for each image, then use the <code>beforeShow</code> callback to wrap the image with an <code>&lt;a&gt;</code> and its corresponding <strong>link</strong> like : </p> <pre><code>$(document).ready(function() { $("#manual1").click(function() { $.fancybox.open([ { href: 'http://fancyapps.com/fancybox/demo/1_b.jpg', title: 'this image links to bbc news', link: 'http://www.bbc.co.uk/news/'}, { href: 'http://fancyapps.com/fancybox/demo/2_b.jpg', title: 'this image links to jquery', link: 'http://jquery.com'}, { href: 'http://fancyapps.com/fancybox/demo/3_b.jpg', title: 'this image links to fancybox', link: 'http://fancyapps.com'} ], { beforeShow: function() { $(".fancybox-image").wrap('&lt;a href="' + this.link + '" /&gt;') }, padding: 38, nextEffect: 'fade', prevEffect: 'fade' }); return false; }); }); // ready </code></pre> <p>In this way you don't need to pass a long <code>data-</code> attribute in your html (no split needed either) and keep it as simple as :</p> <pre><code>&lt;a id="manual1" href="javascript:;"&gt;&lt;img src="/example-thumb.png" alt="example" /&gt;&lt;/a&gt; </code></pre> <p>See <strong><a href="http://jsfiddle.net/w6p49/" rel="nofollow">DEMO</a></strong></p> <p><strong>NOTICE</strong> that in my demo, I changed the css properties of the navigation arrows to avoid overlapping with the linked image.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload