4

When I use fancybox for iframe, the loading icon isn't displayed while fancybox is loaded...

How can I fix this problem?

Thanks in advance.

King Julien
  • 10,981
  • 24
  • 94
  • 132
  • Which loading icon do you mean? What exactly do you mean by "fancybox is loaded", the javascript or the iframe? – Pekka Jun 22 '10 at 16:28
  • did you see any 404 in firbug net tab? Check it once. – Teja Kantamneni Jun 22 '10 at 16:29
  • Normally when I click links that use fancybox a small loading icon is displayed in the center of the screen, but if fancybox type is iframe, the icon isn't displayed... – King Julien Jun 22 '10 at 16:32

2 Answers2

6

For FancyBox 2 showing loader with overlay

To show

$.fancybox.showLoading();
$.fancybox.helpers.overlay.open({parent: $('body'), closeClick : false});

To hide

$.fancybox.hideLoading();
$.fancybox.helpers.overlay.close();
Kunal Panchal
  • 1,049
  • 11
  • 19
4

Fancybox have some bugs or problems when using iframes.

You can edit the source code (not the compressed, packed or minified version) and put this:

$.fn.fancybox.showLoading();

For displaying the loading box in FancyBox 2:

$.fancybox.showLoading()  ;

right after this:

} else if (href.match("iframe") || elem.className.indexOf ("iframe") >= 0) {

I think its in line number 131 but I'm not sure you just need to search for it in the source code.

This and nother (more complicated) solutions, are in the support group of Fancybox:

Fancybox iframe loading icon fix

loading indicator

or do a search in the Fancybox support group.

Good look!

Rene Pot
  • 24,681
  • 7
  • 68
  • 92
Jonathan
  • 8,676
  • 20
  • 71
  • 101
  • There is no such line in fancybox 1.3.1! – King Julien Jun 24 '10 at 18:00
  • mmm so possible they are talking about an earlier version of the script.... theres nothing else in the support group? maybe you can open a new post there... – Jonathan Jun 24 '10 at 19:13
  • the other option I found in the G-group was to change the overlay (#fancybox-overlay in v2.0.6) to be the loading spinner, when the iframe eventually loads it's placed over the spinner. – Dead.Rabit Aug 15 '12 at 12:41