PragueExpat schrieb:
My question: is it better to define this function as above and pass this
or to define an anonymous function within the .each statement? I read that
the above method only has to compile the function once, as opposed to a
re-compile each time the (anonymous) function runs.
, January 25, 2007 4:37 PM
Subject: Re: [jQuery] External or anonymous function - which is best?
PragueExpat schrieb:
My question: is it better to define this function as above and pass this
or to define an anonymous function within the .each statement? I read that
the above method only has
Prague Expat schrieb:
Thanks, that makes sense. One more thing - after this code runs, is the
resizeDiv function in the global namespace, in a persistant JQuery object,
or garbage collected?
The DOM ready function provides a private scope, therefore the function
shouldn't be visible anywhere
$(document).ready(function(){
function resizeDiv(that){
var x = $(that);
if(x.height() 600){
x.css(height,600px);
}
};
$(#mydiv).each(function(){resizeDiv(this)});
});
My question: is it better to define this function as above
and pass this or to define an