こんにちはすべて私はかなり簡単な機能を持っています
enableModule : function(moduleName){
var module = $('div#'+moduleName);
console.log('enabling '+moduleName);
console.time('animate');
module.animate({'opacity' : '1.0'}, 300, function(){console.timeEnd('animate');});
module.find('.disabled_sheild').remove();
module.removeClass('disabled');
console.log('end of enable Module');
}
アニメーション自体、不透明度の変化は非常に高速ですが、呼び出すのが遅れるようなものです。console.time()は、2540MS以上の時間を報告しています。div#moduleがその子と一緒にアニメーション化されているためかもしれないと思いますか?しかし、同じことを逆に実行し、妥当な速度で実行される別の関数「disableModule」があるため、このdosentは理にかなっています。
これがモジュールの無効化機能です。かなり多くのことが行われていますが、約242msの時間が返されます
disableModule : function(moduleName){
$('div#'+moduleName+', div.'+moduleName).each(function(){
var module = $(this);
module.prepend('<div class="disabled_sheild"></div>');
var sheild = module.find('.disabled_sheild');
sheild.css({'position' : 'absolute', 'z-index' : '200'});
sheild.width(module.width());
sheild.height(module.height());
jQuery.each(jQuery.browser, function(i) {
if($.browser.msie){
//module.css("display","none");
//if using ie give sheild a transparent background layout
}else{
console.time('animate');
module.animate({'opacity' : '0.5'}, function(){ console.timeEnd('animate');});
}
});
});
}