简体   繁体   中英

jQuery Optimizations

I've just come to the end of a large development project. We were on a tight timeline, so a lot of optimization was "deferred". Now that we met our deadline, we're going back and trying to optimize things.

My questions is this: What are some of the most important things you look for when optimizing jQuery web sites. Alternately I'd love to hear of sites/lists that have particularly good advise for optimizing jQuery.

I've already read a few articles, http://www.tvidesign.co.uk/blog/improve-your-jquery-25-excellent-tips.aspx was an especially good read.

@aepheus, here is another site for reference: www.artzstudio.com/2009

Check out #8 on Eliminate Query waste. hth

mostly i look at selectors that repeat themselfs.. most of the times these can be saved into a variable and used over and over, for example:

$('.some_class').doSomthing();
$('.some_class').doSomethingElse();

can be turned into:

selectedItems = $('.some_class');
selectedItems.doSomething(); selectedItems.doSomethingElse();

this way the selector goes over the DOM once... then you can continue to use the variable as a jquery object thanks to the fact that every jquery method returns the jquery object.

Just one tip out of many out there...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM