views:

1629

answers:

2

I can't make my div visible with the jquery show() until my function is over! It actually works in IE/FF but not in Chrome. How can I make sure my element is visible before continuing with my function?

Here's my code:

function doOperation(){
    $("#progressbar_area").show();
    (...)
}
+1  A: 

Add a callback to show:

$("#progressbar_area").show(speed, function() {});

The callback function will be called when the animation is complete.

kgiannakakis
A: 

IMO, it would be better to put the rest of your function in the callback parameter to show:

$("#progressbar_area").show("fast", function() {...} );

The caveat here is that the callback is fired (separately) for each element that is in the selector. Fine if you are only showing one item, though.

Marc Gravell
hopefully there will only be one element with an id of progressbar_area!
redsquare