如何使用 jQuery 为 IE8 设置背景图像(使用过滤器属性)?
How to set an background-image (using filter attribute) for IE8 using jQuery?
对于Chrome和其他浏览器,我们使用
$('.dummyActive').live("click", function(event){
$('#imageClass').css("background- image","url(web/M425/images/imgAcc/cards/"+arrayElement[this.id.match(/\d+/)]+") ");
});
现在,由于背景大小不适用于 IE8,
我正在使用这个 CSS,
.imageClass{
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='web/M425/images/imgAcc/cards/summyImg.png',sizingMethod='scale')
}
和上面的 CSS 当我使用 CSS 给它时工作,但我不知道如何使用 jquery 动态地将图像设置为过滤器。
现在如何使用 javascript 或 JQuery.
为上述 dummyActive 实时功能设置图像(对于 IE8)
所以,我正在尝试将过滤器属性设置为 dummyActive class(下面的代码)但它不起作用,因为我同时使用了两种引号和双引号。
$('.dummyActive').live("click", 函数(事件){
$('#imageClass').css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='web/M224/images/imgAcc/cards/"+arrayAccountImage[this.id.match(/\d+/)]+"',sizingMethod='scale'+")");
});
对于 CSS 过滤器尝试“-ms-filter”而不是 "filter"
IE8 ignores "filter" CSS styles
对于Chrome和其他浏览器,我们使用
$('.dummyActive').live("click", function(event){
$('#imageClass').css("background- image","url(web/M425/images/imgAcc/cards/"+arrayElement[this.id.match(/\d+/)]+") ");
});
现在,由于背景大小不适用于 IE8, 我正在使用这个 CSS,
.imageClass{
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='web/M425/images/imgAcc/cards/summyImg.png',sizingMethod='scale')
}
和上面的 CSS 当我使用 CSS 给它时工作,但我不知道如何使用 jquery 动态地将图像设置为过滤器。
现在如何使用 javascript 或 JQuery.
为上述 dummyActive 实时功能设置图像(对于 IE8)所以,我正在尝试将过滤器属性设置为 dummyActive class(下面的代码)但它不起作用,因为我同时使用了两种引号和双引号。
$('.dummyActive').live("click", 函数(事件){
$('#imageClass').css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='web/M224/images/imgAcc/cards/"+arrayAccountImage[this.id.match(/\d+/)]+"',sizingMethod='scale'+")");
});
对于 CSS 过滤器尝试“-ms-filter”而不是 "filter"
IE8 ignores "filter" CSS styles