Gif loading while function runs

Asked

Viewed 26 times

1

I need to place a gif load while a function performs. The function simply changes the value of various products, when the user clicks the gif button should appear and when the inputs are filled it should disappear.

$("#aumentar").click(function(){
  var ajuste = $("#valor").val();
  $('.gif').css('display','block');
  trocaValoresInputs(ajusteDeValor);
  $('.gif').css('display','none');
});
  • has several similar questions on the site like https://answall.com/q/275156/57220 and this https://answall.com/q/107933/57220

1 answer

0

Your idea is correct, when starting the process you must display the element of loading and when finishing the process, you must hide it, if only watch for the function trocaValoresInputs must be synchronous, if it is asynchronous it will continue running under the cloths and will hide the loading before you expect.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.