1

I stuck with setting up the Fancybox window for my photos, I am doing it like this:

$(document).ready(function() {  
  $('.fancybox').fancybox();
});

This is initialization of Fancybox. Then the setup of links and images:

= link_to i.file_url, :class => 'fancybox', :rel => 'gallery', :title => i.title do
  = image_tag i.file_url, :style => 'width: 150px;'

which generates this HTML code:

<a href="URL TO FILE" class="fancybox" rel="gallery" title="Item Name">
  <img alt="something" src="URL TO FILE" style="width: 150px;">
</a>

But when I click on the link, the image is loaded in the new window instead of in the Fancybox window. The Fancybox JS+CSS libraries are added correctly - what am I missing yet?

Thanks

user984621
  • 46,344
  • 73
  • 224
  • 412

1 Answers1

0

The problem in your case is that your URL pattern is not identified by fancyBox.

You should explicitly specify it in your options:

    $('.fancybox').fancybox({type:'image'});
MasterAM
  • 16,283
  • 6
  • 45
  • 66