Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery FadeTo causing pixelated text in IE8 when font-weight: bold

Tags:

jquery

css

fadeto

I am fading out, and in a div:

$('.formErrors').fadeTo('fast', 0); 
$('.formErrors').fadeTo('slow', 1);

But when I do this in IE 8, it seems this bit of CSS:

.formErrors li { font-weight: bold; }

Is causing the text to come back quite distorted: (image below)

http://www.newmania.com/images/error.jpg

The HTML I am applying this to is:

<div class="formErrors">
There are errors in your submission. Please fix the following and try again:
<ul><li>Action is empty</li></ul>
</div>

It works fine in Firefox. Any ideas please?

like image 897
Newmania Avatar asked Dec 08 '09 09:12

Newmania


4 Answers

A common solution is to define a background color, if you don't already have an image:
http://jsbin.com/axapa

.formErrors {background-color:white;}

Another option is to use fadeIn and fadeOut: the animation is till ugly, but at least it ends up nicely: http://jsbin.com/aboxa

like image 74
Kobi Avatar answered Oct 23 '22 23:10

Kobi


jQuery.fn.fadeIn = function(speed, callback) { 
return this.animate({opacity: 'show'}, speed, function() { 
    if (jQuery.browser.msie)  
        this.style.removeAttribute('filter');  
    if (jQuery.isFunction(callback)) 
        callback();  
});
};
jQuery.fn.fadeOut = function(speed, callback) { 
return this.animate({opacity: 'hide'}, speed, function() { 
    if (jQuery.browser.msie)  
        this.style.removeAttribute('filter');  
    if (jQuery.isFunction(callback)) 
        callback();  
});
};
jQuery.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();  
});
};

This code will override some fade properties in JQuery specific to IE. I was able to successfully get fadeTo to work properly in IE here: https://app.tekstme.com/signup/

like image 30
Jeff Avatar answered Oct 24 '22 00:10

Jeff


I know this thread is really old but i found a simple solution. Using background was not applicable for my case because i had a complex background behind text whose background had to be transparent. Anyway I found this one working pretty well (css code to add):

.formErrors{position:relative;}
like image 23
Luka Vidaković Avatar answered Oct 24 '22 00:10

Luka Vidaković


Using <!DOCTYPE html> fixed this issue for me in IE8. The text still looks blocky during the fade but afterwards it smoothes out

like image 28
user96813 Avatar answered Oct 23 '22 22:10

user96813