Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css IE8背景尺寸:封面_Css_Internet Explorer 8 - Fatal编程技术网

Css IE8背景尺寸:封面

Css IE8背景尺寸:封面,css,internet-explorer-8,Css,Internet Explorer 8,我在我的网站上有缩放图像,一切正常,但在IE8上(在旧版本和新版本上,这一切正常),图像没有像它们那样缩放-我只得到了图像的左上角 以下是图像在firefox、chrome、ie6、ie7、ie9等浏览器上的显示方式: 这就是它在ie8上的表现: 我的图像脚本的部分代码: $('.artykul-tresc p img').each(function() { var img = this; var src = $(img).attr('src'); var width =

我在我的网站上有缩放图像,一切正常,但在IE8上(在旧版本和新版本上,这一切正常),图像没有像它们那样缩放-我只得到了图像的左上角

以下是图像在firefox、chrome、ie6、ie7、ie9等浏览器上的显示方式:

这就是它在ie8上的表现:

我的图像脚本的部分代码:

$('.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);
});
$('.artykul tresc p img')。每个(函数(){
var img=此;
var src=$(img).attr('src');
变量宽度=$(img).width()+'px';
变量高度=$(img).height()+'px';
var wm_top=$(img).height()-38+'px';
var alt=$(img).attr('alt');
var替换=sprintf(“”,src,src,宽度,高度,wm_顶部);
美元(img)。替换为(替换);
});
网站上有代码:

<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>


图像的宽度和高度不是静态的,所以我如何为IE8解决这个问题?

如果您可以使用jQuery解决这个问题,那么可能可以帮助您。此插件是为了解决IE6、IE7和IE8中的后台封面问题而构建的。

我不知道如何将此代码从您的链接添加到我的代码中,这类似于:?因为这对我不起作用,我不知道我做错了什么。