Installed fancybox . Made event handler:

 $('a.fancybox-a-img').click(function() { $(this).fancybox({ helpers: { title : { type : 'float' } }, 'showCloseButton': true }); return false; }); 

The problem is that when you first open the image you need to click twice. After it opens it opens the first time.

What could it be? looked at the events in chrome - only mine. no others.

  • one
    and why .fancybox INSIDE a click ???? Where did this code come from? .fancybox should be assigned when loading the page, study the examples more carefully! - Sergey V.
  • @ SergeyV. Thank. helped - Tsyklop
  • moved in response, note plyiz if the answer is correct - Sergey V.

1 answer 1

And why .fancybox INSIDE a click ???? Where did this code come from? .fancybox should be assigned when loading the page, study the examples more carefully!