[ACCEPTED]-Show a javascript loader image while function is executing-jquery

Accepted answer
Score: 16

Although what you have should work, try doing 4 this:

$('#btn').click(function() {
    setTimeout(function() {
        <time consuming function>
    }, 0);

This will escape the call stack of 3 the event.

If THAT doesn't work, then post 2 more details as to what this mystery time 1 consuming function is.

Score: 1

For various reasons JS has to execute on 10 the main thread, which means that painting 9 is blocked as long as JS is executing -- even 8 multiprocess architectures like chrome cannot 7 repaint a tab if that tab is executing JS.

Your 6 only way to get painting to occur will be 5 to split up execution of your function, or 4 move the function onto an html5 worker thread 3 -- and they only work on the betas of Firefox 2 and Safari (or more generally any sufficiently 1 recent build of webkit proper)

More Related questions