Fancybox uses AlphaImageLoader for IE. AlphaImageLoader expects image
paths to be relative to the HTML document, while CSS expects image
paths to be relative to style sheet files. This causes a problem in
certain environments (e.g. when a framework being used reroutes
requests) -- the close button and gallery navigation buttons aren't
displayed in IE. I've solved this problem by URL rewriting
in .htaccess file, but I wish I didn't have to do this.
Roman
As I understand it, there are 4 alternatives to solve the
AlphaImageLoader.src path issue:
1. put fancybox images within the directory (or directory tree) of
each HTML page that uses it. But there are many (actually ALL pages!),
and this is very intrusive: I'll have fancybox files copied (or
linked) many times. This is both cumbersome to install and update.
2. edit css to replace the relative path by absolute image path. But
this path will be different for all my different servers, and also for
dev and prod modes... And I don't know (and don't want to care about)
the absolute path on production servers.
3. URL rewriting in .htaccess. I did not experience this method
mentionned by Roman, but I think it has the same defects as solution
2, plus it is "apache" specific.
4. Javascript in CSS: I've seen http://drupal.org/node/185866 but
still did not experience it. It seems possible to provide
programatically (in javascript) the URL. This sounds interesting, and
could probably be included in fancybox itself: the path to look these
images into could be relative ("fancybox/" as it is today) by default,
but could be overridden with a configuration dependent path prefix
(usually an absolute one), which could itself by computed by another
mean (not a fancybox matter).
Does anyone have another solution to propose? Has anyone experimented
solution 4? Would fancybox team consider doing it?
Thanks for this nice library anyway
Another approach - remove AlphaImageLoader filters from CSS, like so-
#fancybox-loading.fancybox-ie div { background:
url('fancy_loading.png') top left no-repeat; } and than apply any
pngFix that uses AlphaImageLoader (you could even take pngFix script
from older versions of fancybox).
Janis
I guess long term a solution moving forwards might be for FB to take
an argument (optional) setting base path?
I just ran into this issue as well. I noticed what was going on after
seeing 404's in Fiddler.
I'm using Fancybox 1.3.1 in Drupal using the Fancybox module.
Anyway, I've updated the CSS and everything is great.
My only concern, from a Drupal module perspective, is that a user can
not just install a module, unpack Fancybox into /sites/all/libraries
and off they go. They will always have to make a change.
Ugh, IE6!!!
-- Jason
Example:
#fancybox-loading.fancybox-ie div {
background: transparent;
behavior:
expression(this.runtimeStyle.filter?'':this.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
(function(){var t=document.getElementsByTagName('link');for(var
i=0;i<t.length;i++){var h=t[i].href.split('?')[0];if(h&&/
jquery.fancybox-1.3.1\\.css$/.test(h)){return
h.replace('jquery.fancybox-1.3.1.css','');}} return '';})() +"../
images/fancybox/fancy_loading.png',sizingMethod='scale')");
}
It will loop all link tags until it finds jquery.fancybox-1.3.1.css
and ignores '?foo=bar' from that css file and then returns the proper
path to that css file. In my example I'm keeping my css files in css -
folder and all the images in images/fancybox -folder.
Hope this helps to solve WordPress & Drupal problems.
-Jani
Jani's behaviour fix didn't work for me. So I downgraded to 1.2.6 and
it worked straight away. It seems the PNG AlphaImageLoader for IE is a
waste of time.
You can get 1.2.6 at http://fancybox.googlecode.com/files/jquery.fancybox-1.2.6.zip
Working sample: http://pastebin.com/D8YqLzQK
I think the reason why it didn't work for you was due to those dots in
the filename.
Use "jquery\\.fancybox-1\\.3\\.1\\.css" instead of
"jquery.fancybox-1.3.1\\.css".
-Jani
/resources/fancybox/jquery.fancybox-1.3.1.css
/* IE */
#fancybox-loading.fancybox-ie div { background: transparent; filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_loading.png', sizingMethod='scale'); }
.fancybox-ie #fancybox-close { background: transparent; filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_close.png', sizingMethod='scale'); }
.fancybox-ie #fancybox-title-over { background: transparent; filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_title_over.png', sizingMethod='scale'); zoom: 1; }
.fancybox-ie #fancybox-title-left { background: transparent; filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_title_left.png', sizingMethod='scale'); }
.fancybox-ie #fancybox-title-main { background: transparent; filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_title_main.png', sizingMethod='scale'); }
.fancybox-ie #fancybox-title-right { background: transparent; filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_title_right.png', sizingMethod='scale'); }
.fancybox-ie #fancybox-left-ico { background: transparent; filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_nav_left.png', sizingMethod='scale'); }
.fancybox-ie #fancybox-right-ico { background: transparent; filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_nav_right.png', sizingMethod='scale'); }
.fancybox-ie .fancy-bg { background: transparent !important; }
.fancybox-ie #fancy-bg-n { filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_shadow_n.png', sizingMethod='scale'); }
.fancybox-ie #fancy-bg-ne { filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_shadow_ne.png', sizingMethod='scale'); }
.fancybox-ie #fancy-bg-e { filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_shadow_e.png', sizingMethod='scale'); }
.fancybox-ie #fancy-bg-se { filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_shadow_se.png', sizingMethod='scale'); }
.fancybox-ie #fancy-bg-s { filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_shadow_s.png', sizingMethod='scale'); }
.fancybox-ie #fancy-bg-sw { filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_shadow_sw.png', sizingMethod='scale'); }
.fancybox-ie #fancy-bg-w { filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_shadow_w.png', sizingMethod='scale'); }
.fancybox-ie #fancy-bg-nw { filter:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/resources/
fancybox/fancy_shadow_nw.png', sizingMethod='scale'); }