I am using HTML5 Canvas. I have loaded an image of size 7MB inside a canvas element. On my page I have a ConvertImage button:
var imageUrl;
$("#ConvertImage").click(function() {
$("#Spinner").show();
imageUrl = $("#canvas")[0].toDataURL("image/png;base64;");
});
The Spinner is just an animated gif. It turns out that the Spinner is not shown right away when I try to retrieve the imageUrl in the next statement. Without the second operation the spinner is shown right away. It feels like the spinner is shown after the toDataURL() operation is completed.
This is strange because the show() function is executed before the toDataURL() operation.
How can I fix this problem?