Thanks for the explanation, Karl. That makes a lot of sense.
Your chunking solution does seem to prevent the unresponsive
script errors when the page is loading. However, I still get them
when I navigate away from the page -- I assume jquery is unbinding
all of the cluetips.
For that reason
Thanks to both Karls for your help!
I'll definitely try out the chunking method. Since I'd like to
understand what I'm implementing, can you briefly explain why this way
is better?
thanks,
az
On Apr 1, 4:59 pm, Karl Rudd [EMAIL PROTECTED] wrote:
You can initialise the tips in chunks.
JavaScript in browsers is single-threaded (and thank goodness for
that). So when JavaScript is running (in most browsers) everything
else is queuing up. When you break the code into chunks, via
setTimeout, you are (essentially) yielding control back to the main
event loop periodically, so it has
Hi az,
The only way I know of to deal with binding events to that many
elements directly without incurring huge costs (unresponsive script
errors, etc.) is to do it inline, as you suggested.
Another approach is event delegation, but I haven't set up the plugin
to take advantage of that
You can initialise the tips in chunks.
Instead of doing something like this:
$('a.tip').cluetip();
Do something like this:
$('a.tip').each(function() {
var t = $(this);
setTimeout( function() { t.cluetip(); }, 10 );
})
You'll still have a bit of a CPU usage spike but it shouldn't
Ah, great idea! thanks, Karl
--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Apr 1, 2008, at 7:59 PM, Karl Rudd wrote:
You can initialise the tips in chunks.
Instead of doing something like this:
$('a.tip').cluetip();
Do something like this:
6 matches
Mail list logo