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
$(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!!!);
return
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
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
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
5 matches
Mail list logo