user1919
user1919

Reputation: 3938

Execute JS code after the photo has started downloading with ht

I am using html2canvas and Canvas2Image in order to get a screenshot of a map on my screen. The functionality is running on a button click like this:

$(document).ready(function() {
  $("#screenshot2").click(function(){
    html2canvas($("#OpenLayers_Map_15_OpenLayers_ViewPort"), {
        useCORS: true,
        onrendered: function(canvas) {
            theCanvas = canvas;
            // Convert and downloadimg-out as image
            Canvas2Image.saveAsPNG(canvas);
        }
    });
  });
  });

What I want is to have a loading sign while the process is running. It's easy to initiate the "loading image" on button click, but I haven't figured out how to stop it. For example, in Ajax, there are the beforeSend and afterSend. Is there something equivalent in this case?

Upvotes: 0

Views: 44

Answers (0)

Related Questions