views:

291

answers:

2

When using jquery's load function, the page freezes until it has loaded.

How can I get around that?

I have a script that makes all links load through ajax, into a div in the page. I also made it so that it would make another div reload (the navigator).

Whilst this is going on, another script refreshes every now and then, reloading another div.

But if I stay on the page, and the one that refreshes every now and then 'reloads', the page shall freeze until it has loaded.

It's the same behaviour with the others too.

+1  A: 

I suspect this depends heavily on what exactly you are doing in the load() event. If the answer is "nothing", that will require different measures than if the answer is "walking a 1,000-element DOM tree." I'm going to guess that you are doing something in the load event. Improving performance will be a matter of refactoring and deferring processing as much as possible.

It would also be helpful to know which browser you're using. Different browsers respond to javascript very differently.

Dave Swersky
+1  A: 

Do you mean AJAX Load? If you have this placed at the top of your page, and that page has other HTML elements to it which don't need to be loaded in, consider placing the JavaScript at the bottom of the page, so it is the last thing to be loaded.

jakeisonline