chrismytton / fancybox-rails

Use FancyBox with the Rails asset pipeline

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Width not computed correctly

alecguintu opened this issue · comments

Hi hecticjeff,

I've used fancybox before but it wasn't with rails and this would be my first time to use it with rails. Now I don't know if this is cause of this or cause of fancybox.

I'm loading a big image from a thumbnail to a fancybox. But on first click, the image loads but the computations are off. Like the width of fancybox is 0 and it's not displayed. But when I just click on the background and click the thumbnail again, it works perfectly.

Have this happened to you as well?

Cheers!

Hi!

The gem just vendors a copy of fancybox for use in the asset pipeline, I haven't added any extra javascript, so I believe the problem you are experiencing is with fancybox itself.

I've never had any problems using this with thumbnails myself. Are you linking directly to the full size image with the <a> tag?

Are there any errors displayed on the console when you get the mis-calculation error?

Hope this helps.

I knew it. Haha. Yes. It's in an <a> tag

  <a href="/events/4eb00e96be9294046600000a/big_banner" data-mode="fancybox">
    <img alt="The-script-live-in-manila1" src="/system/banners/4eb00e96be9294046600000a/thumb/The-Script-Live-in-manila1.jpg?1321362294" data-original-title="Event#4 on 2011-11-29 23:21:58 +0800">
  </a>

and it doesn't show any problems in the chrome console... Hrmn

Thanks btw.