I have a page that is full of divs and the JSGraphIt.initPageObjects() draws connectors between the divs. The div and connector information is populated from a db. I want to add a load animation to the page as the divs are populating and connectors are being drawn, so I added the loader div and $(".loader").fadeOut("slow"); to the window load function.
However, there is a long delay - about a second or two - before the loading animation shows, which defeats the purpose of the animation.
I noticed that if I remove the JSGraphIt function, the animation starts right away, but I cannot remove that function. I have also tried moving the animation to the document ready function instead but then the loading animation doesn't show at all.
Thanks in advance for your help.
<script type="text/javascript">
function onLoad()
{
JSGraphIt.initPageObjects();
}
$(window).load(function() {
$("#closeprint").hide();
// Set Canvas Size
var height = $(window).height();
var width = $( window ).width();
canvasHeight = height - 285;
$("#container").css({"height" : canvasHeight});
$("#header").css({"min-width" : width});
$("#container").css({"min-width" : width});
$("#legend").css({"min-width" : width});
$("#footer").css({"min-width" : width});
$(".loader").fadeOut("slow");
});
$(function() {
Some other functions
});
</script>