Javascript “jQuery如何做”;“褪色”;在IE8及以下版本中?
我只是想知道当IE浏览器不支持透明度时,jQuery如何在IE浏览器中产生淡入淡出效果?在Firefox和Chrome等其他浏览器中,动画<代码>不透明度代码>是淡入淡出的方式。Javascript “jQuery如何做”;“褪色”;在IE8及以下版本中?,javascript,jquery,Javascript,Jquery,我只是想知道当IE浏览器不支持透明度时,jQuery如何在IE浏览器中产生淡入淡出效果?在Firefox和Chrome等其他浏览器中,动画不透明度是淡入淡出的方式。 我研究了代码,但老实说,我找不到任何我能理解的东西 使用以下样式的过滤器:alpha(不透明度=40)从jquery源代码中,它们基本上检测不透明度是否受支持,如果不受支持,则使用IEs alpha过滤器 if ( !jQuery.support.opacity ) { jQuery.cssHooks.opacity = {
我研究了代码,但老实说,我找不到任何我能理解的东西 使用以下样式的过滤器:alpha(不透明度=40)从jquery源代码中,它们基本上检测不透明度是否受支持,如果不受支持,则使用IEs alpha过滤器
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
( parseFloat( RegExp.$1 ) / 100 ) + "" :
computed ? "1" : "";
},
set: function( elem, value ) {
var style = elem.style,
currentStyle = elem.currentStyle;
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// Set the alpha filter to set the opacity
var opacity = jQuery.isNaN( value ) ?
"" :
"alpha(opacity=" + value * 100 + ")",
filter = currentStyle && currentStyle.filter || style.filter || "";
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}