Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try this instead (<a href="http://jsfiddle.net/Mottie/ANLxC/3/" rel="nofollow">demo</a>):</p> <pre><code>'titleFormat' : function(title, currentArray, currentIndex, currentOpts) { $title = ''; var current = currentIndex; if(current &gt; 0){ $title += '&lt;a href="#" onclick="$.fancybox.prev();return false;" id="fancybox-prev-btn"&gt;&lt;/a&gt;'; } if(current &lt; currentArray.length - 1){ $title += '&lt;a href="#" onclick="$.fancybox.next();return false;" id="fancybox-next-btn"&gt;&lt;/a&gt;'; } $title += '&lt;span class="fancybox-title"&gt;' + title + '&lt;span class="fancybox-title-count"&gt;(image ' + (currentIndex + 1) + ' of ' + currentArray.length + ')&lt;/span&gt;&lt;/span&gt;&lt;br class="clearBoth"/&gt;'; return $title; } </code></pre> <p>I changed the links to have a <code>href="#"</code> instead... just personal preference since I don't like seeing "javascript" pop up when I hover over a link.</p> <hr> <p>Update for FancyBox 2.1+ (<a href="http://jsfiddle.net/ANLxC/71/" rel="nofollow">demo</a>)</p> <p>CSS</p> <pre><code>#fancybox-prev-btn, #fancybox-next-btn { position: absolute; top: 0; width: 30px; height: 30px; margin-left: -50px; cursor: pointer; z-index: 1102; display: block; background-image: url('http://i56.tinypic.com/s5wupy.png'); } #fancybox-prev-btn { background-position: -40px -30px; left: 0; } #fancybox-next-btn { background-position: -40px -60px; left: 30px; } </code></pre> <p>Javascript</p> <pre><code>$(selector).fancybox({ beforeLoad: function() { var title = ''; if (this.index &gt; 0) { title += '&lt;a href="#" onclick="$.fancybox.prev();return false;" id="fancybox-prev-btn"&gt;&lt;/a&gt;'; } if (this.index &lt; this.group.length - 1) { title += '&lt;a href="#" onclick="$.fancybox.next();return false;" id="fancybox-next-btn"&gt;&lt;/a&gt;'; } title += '&lt;span class="fancybox-title"&gt;' + $(this.element).find('img').attr('alt') + '&lt;span class="fancybox-title-count"&gt;(image ' + (this.index + 1) + ' of ' + this.group.length + ')&lt;/span&gt;&lt;/span&gt;&lt;br class="clearBoth"/&gt;'; this.title = title; } }); </code></pre>
 

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