[jQuery] Re: A demo and an optimization question

2007-05-29 Thread Jörn Zaefferer
Dan G. Switzer, II wrote: $(document).bind("click", function (e){ // get the target element (srcElement for IE, originalTarget for W3C) var el = e.srcElement || e.originalTarget; if( el.tagName == "A" && el.className == "icon" ){ alert("Hey, I'm an a.icon

[jQuery] Re: A demo and an optimization question

2007-05-29 Thread Dan G. Switzer, II
>$(document).bind("click", function (e){ > // get the target element (srcElement for IE, originalTarget for >W3C) > var el = e.srcElement || e.originalTarget; > if( el.tagName == "A" && el.className == "icon" ){ > alert("Hey, I'm an a.icon element!!!"); >

[jQuery] Re: A demo and an optimization question

2007-05-29 Thread Dan G. Switzer, II
David, >I've been using jquery to build an icon picker for FAMFAMFAM's Silk >icon set. I've got a working version (at http://dsingleton.co.uk/code/icon- >selector/), >but with 1000 images on the page everything is a little slow, i'm >wondering what I can do to optomize the JS make it a little sna

[jQuery] Re: A demo and an optimization question

2007-05-27 Thread [EMAIL PROTECTED]
David, I'm not sure how coincidential life could be, but i just began working on the same icon set last night. Although its not relevant to jquery, you can see a HUGE optimisation boost using css sprites. This will get all 1,000 icons within view in about 1-2 seconds (as opposed to several m

[jQuery] Re: A demo and an optimization question

2007-05-27 Thread David Singleton
Thanks for the tips. Always using element.class in selectors makes sense, I should make it a habbit rather than being lazy. I understand about the idea of ID for a unique instance and classes for repeated types, but this was thrown together rather quickly as a demo, so the semantics aren't perfec

[jQuery] Re: A demo and an optimization question

2007-05-27 Thread Sean Catchpole
I think the problem is not the javascript, but instead the browser. Trying to change the display of a thousand items can cause it to be a little slow. I present to you a small example, that shows javascript can handle many items at once, and since the browser only has to display a few items at on

[jQuery] Re: A demo and an optimization question

2007-05-27 Thread Renato Formato
David Singleton ha scritto: I've been using jquery to build an icon picker for FAMFAMFAM's Silk icon set. I've got a working version (at http://dsingleton.co.uk/code/icon-selector/), but with 1000 images on the page everything is a little slow, i'm wondering what I can do to optomize the JS mak