Css 修改跨浏览器灰度过滤器的jQuery选择器
希望使用跨浏览器灰度过滤器,并使其在所有图像上工作,但我想将效果限制为单个div中的图像 在function.js中,我将选择器的所有实例从Css 修改跨浏览器灰度过滤器的jQuery选择器,css,debugging,jquery-selectors,internet-explorer-11,Css,Debugging,Jquery Selectors,Internet Explorer 11,希望使用跨浏览器灰度过滤器,并使其在所有图像上工作,但我想将效果限制为单个div中的图像 在function.js中,我将选择器的所有实例从grayscale($('img'))更改 到grayscale($('#grayscale div img')并在所有实例中都这样做。它添加了CSS类,但在IE11中,效果不再有效 我想看看这是否是我在使用jQuery选择器时犯的错误。提前谢谢你为我指明了正确的方向 代码摘录: if (getInternetExplorerVersion() >=
grayscale($('img'))更改代码>
到grayscale($('#grayscale div img')
并在所有实例中都这样做。它添加了CSS类,但在IE11中,效果不再有效
我想看看这是否是我在使用jQuery选择器时犯的错误。提前谢谢你为我指明了正确的方向
代码摘录:
if (getInternetExplorerVersion() >= 10){
$('#grayscale-div img').each(function(){
var el = $(this);
el.css({"position":"absolute"}).wrap("<div class='img_wrapper' style='display: inline-block'>").clone().addClass('img_grayscale').css({"position":"absolute","z-index":"5","opacity":"0"}).insertBefore(el).queue(function(){
var el = $(this);
el.parent().css({"width":this.width,"height":this.height});
el.dequeue();
});
this.src = grayscaleIE10(this.src);
});
// Quick animation on IE10+
$('#grayscale-div img').hover(
function () {
$(this).parent().find('img:first').stop().animate({opacity:1}, 200);
},
function () {
$('.img_grayscale').stop().animate({opacity:0}, 200);
}
);
if(getInternetExplorerVersion()>=10){
$('#灰度div img')。每个(函数(){
var el=$(本);
css({“位置”:“绝对”}).wrap(“”.clone().addClass('img_grayscale').css({“位置”:“绝对”,“z索引”:“5”,“不透明度”:“0”}).insertBefore(el).queue(函数(){
var el=$(本);
el.parent().css({“width”:this.width,“height”:this.height});
el.dequeue();
});
this.src=grayscaleIE10(this.src);
});
//IE10+上的快速动画
$(“#灰度div img”)。悬停(
函数(){
$(this.parent().find('img:first').stop().animate({opacity:1},200);
},
函数(){
$('.img_grayscale').stop().animate({opacity:0},200);
}
);
IE11中的getInternetExplorerVersion()
条件检查失败。以下更改:
if(getInternetExplorerVersion() >= 10 || !!window.MSInputMethodContext)
将在上面显示的代码中修复它。以下是一些无关的问题,它们解释了问题和解决方案: