How do I make jQuery () load not freeze the page?

When using jquery's load function, the page freezes before it loads.

How can I get around this?

I have a script that makes all links load via ajax in a div on the page. I also made it so that it does another reboot (navigator).

While this is happening, the other script is updated from time to time, reloading the other div.

But if I stay on the page and the one that is being refreshed "reloads" from time to time, the page freezes until it loads.

This is the same behavior with others.

+2


source to share


2 answers


I suspect it highly depends on what exactly you are doing in the load () event. If the answer is "nothing", it will take different steps than if the answer was "traversing the 1000-element DOM tree". I'm going to assume that you are doing something in the load event. Improving performance will depend on refactoring and deferring processing as much as possible.



It would also be helpful to know which browser you are using. Different browsers react to javascript in a completely different way.

+1


source


Do you mean AJAX Load ? If you have this spot at the top of the page, and there are other HTML elements on that page that you don't need to load, consider placing JavaScript at the bottom of the page so it's the last thing to do loaded.



+1


source







All Articles