Bind the click element to the body, and let event delegation / bubbling do 
its job. This way you have only one event listener. The function it runs can 
then check the clicked element against a jQuery filter with .is() and run 
stuff if necessary.

Im really busy now, so I'd just point you to check out something I wrote 
earlier (considering rebinding stuff for ajax-loaded links, since this also 
solves that):

http://groups.google.com/group/jquery-en/browse_thread/thread/da8d6815e14b93a3/14805d2432ed0a61?lnk=st&q=juha+suni+event+bubbling&rnum=2#14805d2432ed0a61

I'll gladly tell more if that doesn't help. That should however give you a 
big performance boost, since at no point are you really looping through all 
the DOM items, and their amount shouldn't really have an effect.

HTH

-- 
Suni

Alessandro Portale wrote:
> Hi,
>
> I have a page with about 12000 links in it. A few of these links point
> to anchors on the same page. A function should be called when those
> "intra page" links are clicked.
>
> $("[EMAIL PROTECTED]").click(...) seems to be too slow for some browsers on
> some machines if 12000 links need to be filtered.
>
> I hoped that $(window).click(...) could give me the possibility to
> handle the new window.location on-the-fly but unfortunately my bound
> function is called before the browser jumps to the anchor, so that
> window.location is still outdated.
>
> Does anybody know another way of on-the-fly reacting to a link click
> which allows to access the new url?
>
> Thanks in advance,
> Alessandro 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery (English)" group.
To post to this group, send email to jquery-en@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to