facyBox icon indicating copy to clipboard operation
facyBox copied to clipboard

IE (any version) /none image request

Open jamesvecore opened this issue 14 years ago • 1 comments

There seems to be a bug with the fixPNG function where it causes IE to make a request for an image for the background-image style with a url that has 'none' in it. This is generating error messages in my application because that url is not a valid request. My solution was to change this:

$(this).css({
                    'backgroundImage': 'none',
...

to this:

$(this).css({
                    'backgroundImage': '',
...

I'm not positive of the repercussion of this change for others, so I will leave it for you to decide if this breaks anything or not.

Thanks,

-Jim

I have verified on IE9 this works, but I don't have access to older versions of IE to test with.

jamesvecore avatar Jun 21 '11 19:06 jamesvecore

A similar problem can be eliminated by making sure you don't preload background-images with the string 'none': This happens to me because I don't use the corner images in my css, preferring border-radius.

  //preloads all the static facybox images
  function preloadImages(){
    //TODO preload prev/next ?
    $('#facybox').find('.n, .close , .s, .w, .e, .nw, ne, sw, se').each(function() {
        bg_img = $(this).css('background-image');
        if (bg_img != 'none') {
                    var img = new Image();
            img.src = bg_img.replace(/url\((.+)\)/, '$1');
            console.log(img.src);
                }
    })
        var img = new Image();
        img.src = '/static/js/facyBox/images/loading.gif';
  }

ajslater avatar Aug 08 '11 20:08 ajslater