CSS Jquery - 当我改变背景颜色时,IE6中的文字会变得模糊吗?

时间:2010-04-29 09:46:15

标签: jquery css jquery-ui

我正在玩这个自动滚动文字的脚本。你可以在这里查看代码:

http://jqueryfordesigners.com/simple-jquery-spy-effect/

然后我将背景颜色更改为白色 - 所有文本看起来都模糊不清 - 如果我将其更改为任何浅色 - 它看起来都很混乱。

这是我在代码中更改背景颜色的部分:

#sidebar {
    color: grey;
    background: #FFF;
    float:left;
    margin:0 0 24px;
    padding:15px 10px 10px;
    width:500px;
}

即使在IE7上,我也在另一个网站上注意到了这一点。不知道为什么背景颜色的简单改变会弄乱文本。

我使用IE测试在IE6浏览器上测试 http://www.my-debugbar.com/wiki/IETester/HomePage

由于

2 个答案:

答案 0 :(得分:3)

你确定你没有在树的更上面的元素中使用IE css过滤器,例如alpha透明度吗?当启用ClearType(LCD监视器上的字体平滑)时,它们可以使文本模糊/模糊,特别是对于粗体文本,以至于对于在IE7 +中使用CSS过滤器的元素禁用了cleartype。

另见http://blogs.msdn.com/ie/archive/2006/08/31/730887.aspx

编辑:以下是您在首次淡入项目后删除过滤器的示例:

// increase the height of the NEW first item
$insert.animate({ height : height }, 1000).animate({ opacity : 1 }, 1000);

可能会转到

// increase the height of the NEW first item
$insert.animate({ height : height }, 1000).animate({ opacity : 1 }, 1000,
    function() {
        if ($.browser.msie) {
            $(this).get(0).style.removeAttribute('filter');
        }
    });

另见jQuery, Animate opacity to 1 then remove the opacity property to make it better looking on IE

答案 1 :(得分:2)

我将完成 David M 问题。 您必须删除IE CSS Filter属性。

我看到你正在使用jQuery。

如果您使用的是fadeIn,fadeOut和fadeTo函数,请将其添加到您的代码中:

(function($) {
$.fn.FadeIn = function(speed, callback) {
$(this).fadeIn(speed, function() {
if(!$.support.opacity)
$(this).get(0).style.removeAttribute('filter');
if(callback != undefined)
callback();
});
};
$.fn.FadeOut = function(speed, callback) {
$(this).fadeOut(speed, function() {
if(!$.support.opacity)
$(this).get(0).style.removeAttribute('filter');
if(callback != undefined)
callback();
});
};
$.fn.FadeTo = function(speed,to,callback) {
return this.animate({opacity: to}, speed, function() {
if (to == 1 && jQuery.browser.msie())
this.style.removeAttribute('filter');
if (jQuery.isFunction(callback))
callback();
});
};
})(jQuery); 

将(fadeIn,fadeOut,fadeTo)替换为(FadeIn,FadeOut,FadeTo)。 (区别在于F)

否则使用:

$(selector).removeAttribute('filter');

如果您需要更多信息评论我的答案,我会编辑:) 我想这就是你想要的。对不起我的英语不好。 :(