Closed kajyr closed 10 years ago
In addition to what kajyr wrote: for my own project I've replaced every called to $("#jq_ez_bg").children() by a variable, and the same for $("#jq_ez_bg").css(), and that made the script twice as fast according to IE 8's profiler. It went from being a script with a noticeable footprint to 'just one of the guys'.
Having said that our problems with IE seemed to have been largely a function of the size of the images, with optimizations counting for a noticeable but not sizeable reduction in lag.
Re: replacing selectors by variables, what that means is that instead of
$('a').x(); $('a').y(); $('a').z();
you do
var a = $('a'); a.x(); a.y(); a.z();
The result being that jQuery doesn't have to traverse the DOM tree all the time.
Moved the bind function inside the plugin. Saved the html elements to a local variable, to reduce (slow) DOM access.