I am not sure whether I understand what's happening there.
You could try by rendering the topmost container element of the page invisible until the script is done.
In the CSS file just assign the display: none
CSS property to the container, or better yet, do it in the inline style to the element like this:
<body>
<div class="body invisible" style="display: none;">
Your content
</div>
<script type="text/javascript">
$("div.body").removeClass("invisible"); //in case JS is present, don't reveal the element until scripts execute.
</script>
<style type="text/css">
div.invisible {display: block !important;} /*In case no JS support present, reveal the content after page fully loads*/
</style>
</body>
Then in the JS do something like this:
/*Your big JS code*/
$("div.body").css("display", "block"); //sets it visible again after code finishes
You can even place a Loading
gif image on the page during this time. Just place a visible container with that background image, and when making the body visible, make that image invisible.
AND, another possible solution to experiment with (not sure about browser compatibility): http://bytes.com/topic/javascript/answers/738083-how-suspend-layout
But it appears that here a poorer solution was accepted: http://stackoverflow.com/questions/2363337/suspend-layout-during-dom-interaction