2011-12-16 44 views

回答

0

一些fix'n和trix'n后...现在的作品:)

function customFades() { 
    (function($) { 
     $.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(); 
      }); 
     }; 

     $.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); 
} 
1

.customFadeIn('slow') 

在你的榜样更换。第二个参数仍然是可选的回调。如果你不需要回调,你可以使用单参数版本。

如果你有一个回调的使用方法:

.customFadeIn('slow', myCallback) // assumes function myCallback() exists 

这customFadeIn东西的关键是只是为了让您不必每次使用渐变时间删除过滤器。

+0

嗯..我不能找到问题..回调运行和工作,但我仍然得到ie故障:/ – Mackelito 2011-12-16 10:34:15