[jQuery] .load() callback

[jQuery] .load() callback


I currently have a problem with the site I am designing, I'm using jQuery to
load the content via AJAX, however. The script I'm using to watch for when
the user clicks a link is:
function watchLinks()
{
$("a").click(function()
{
var youWantToGoTo =
$(this).attr('href').substr(0,$(this).attr('href').length-4); // Determine
destination
openPage(youWantToGoTo); // Open destination
window.location.hash = youWantToGoTo; // Set the url #
return false;
});
};
currently I call the function on the $(document).ready but this means that I
cannot watch the links that are loaded dynamically.
eg when the users loads the 'portfolio' page the watchLinks() function isn't
active for the links which were loaded.
I have tried setting watchLinks() as the callback but when the user quickly
switches between pages the javascript seems to slow down to a snails pace
and pages don't load for a fairly long period of time.
Is there a more efficient method?
http://le.lsdon.com/concept07.htm Here's the site if I didn't provide
enough info.
--
View this message in context: http://www.nabble.com/.load%28%29-callback-tp21389522s27240p21389522.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.