1

I have with scaling images on my site, everything working properly, but on IE8 (on older and newer version this working properly) images not scaling as they have too - I got only upper left corner of the image.

There is how image shows on firefox, chrome, ie6,ie7,ie9 etc.: https://i.stack.imgur.com/DShKc.jpg

and there how it shows on ie8: https://i.stack.imgur.com/aXSrB.jpg

Part of code of my image script:

$('.artykul-tresc p img').each(function() {
    var img = this;
    var src = $(img).attr('src');
    var width = $(img).width() + 'px';
    var height = $(img).height() + 'px';
    var wm_top = $(img).height() - 38 + 'px';
    var alt = $(img).attr('alt');
    var replacement = sprintf("<a href=\"%s\" class=\"fancybox\" rel=\"images\"><div style=\"background-image: url('%s'); background-size: cover; width: %s; height: %s; display: inline-block;\"><img src=\"/static/watermark-photo.png\" style=\"position: relative; top: %s; float: right;\" /></div></a>", src, src, width, height, wm_top);
    $(img).replaceWith(replacement);
});

and there is code from the site:

<a href="/userfiles/image/sufit-podwieszany-armstrong-2.jpg" class="fancybox" rel="images"><div style="background-image: url('/userfiles/image/sufit-podwieszany-armstrong-2.jpg'); background-size: cover; width: 185px; height: 274px; display: inline-block;"><img src="/static/watermark-photo.png" style="position: relative; top: 236px; float: right;"></div></a>

image width and height isn't static, so how I can fix this for IE8?

codingrose
  • 15,563
  • 11
  • 39
  • 58
user3180931
  • 87
  • 2
  • 10
  • http://stackoverflow.com/questions/2991623/how-do-i-make-background-size-work-in-ie – Anup Jan 10 '14 at 08:52
  • I don't know how to put this code from your link into my code, this will be something like: http://pastebin.com/mzS7mUqC ? Because this don't work for me, I don't know what I'm doing wrong. – user3180931 Jan 10 '14 at 09:01

1 Answers1

0

If you're okay with using jQuery to resolve this, then https://github.com/pakcheong/jqthumb might be able to help you. This plugin was built to resolve background-cover issue in IE6, IE7 and IE8.

P.C.
  • 3,751
  • 2
  • 18
  • 17