IE text blur when using jQuery fadeIn
I'm having issues with IE using jQuery fadeIn where text is blury due to the 'filter'. I've searched here and found this solution:
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();
});
};
The problem is that now I get the following error:
Uncaught RangeError: Maximum call stack size exceeded
I call the fadeIn function in a few ways, like this:
$('.item').fadeIn();
$('.item').fadeIn(50);
$('.item').fadeIn(function(){
});
$('.item').delay(500).fadeIn();
$('.item').hide().fadeIn();
I'm not exactly sure where the issue is, but I'm guessing it's with开发者_StackOverflow社区 chaining it or using the callback without specifying speed?
Would anyone know a solution that will make this compatible?
Thank you!
try this (requires jquery 1.6+):
jQuery.fn.fadeIn = function(speed, callback) {
var _this = this;
return this.animate({opacity: 'show'}, speed, callback).promise().done(function() {
if (jQuery.browser.msie)
_this.removeAttr('filter');
});
};
i suspect the issue was the if statements were being called on too many elements. using the complete callback runs the callback on each element, while using the promise method runs it when all elements are done.
精彩评论