My code:
$(document).ready(function () {
$("#divContent").hide();
$("#divProcessing").spin();
$("#divProcessing").show();
setTimeout(function () {
Longrunningfunction1
Longrunningfunction2
Longrunningfunctionn
//All done
$("#divProcessing").hide();
$("#divContent").show();
$("#divContent").style = "margin-top:60px;height:100%;display:''";
$("#tabbed-nav").data('zozoTabs').refresh();
}, 0);
});
Using SetTimeout as above, I managed to get the Processing div to behave properly ie show then hide and show the Content div when everything is completed. The issue is that in IE and FF, the spinner stops spinning after some time. In Chrome it works perfectly and the spinner keeps going.
I have tried:
- forcing a redraw of the Processing div
- using different js spinners (worse behaviour than spin.js - they never appear)
- using css3 animations instead of spin.js (never animates)
- additional settimeouts
- setintervals to attempt to get the ui to redraw.
Nothing has worked thus far. Short of moving my long running processess to a new view, is there anything else I can do? I know these issues are to do with js being single threaded, but since chrome is ok I thought there might be a solution. Thanks.