Проблема в следующем: у меня в WebView есть кнопка, которая вызывает функцию JAVA, и при нажатии на нее Кнопка У меня есть внутренняя функция, которая открывает «загрузочный» DIV, чтобы сообщить пользователю, что я вношу изменения. Но, к сожалению, он работает неправильно.
Код на JavaScript
Код: Выделить всё
$("#somarInj010").click(function(){
valorSub = 0.0;
var valorSoma = 0.1;
valorText = $(".selecionaInput[data-x="+xNow+"][data-y="+yNow+"]").text();
if(selecionado == 1){
divCarregando(1);
valorSub = valorText.replace(",", ".");
valorSub = parseFloat(valorSub) + parseFloat(valorSoma);
var data = android.starter(xNow,yNow,valorSub,2);
var obj = JSON.parse(data);
if(obj.resp == 1){
valorSub = valorSub.toFixed(2);
valorSub = valorSub.replace(".", ",");
$(".selecionaInput[data-x="+xNow+"][data-y="+yNow+"]").text(valorSub);
}else{
alert("error");
}
}
});
Раздел HTML-кода
Код: Выделить всё
[img]../img/gifLoading.gif[/img]
Carregando
Код: Выделить всё
function divCarregando(x){
var contador = 0;
alert(x);
if(x == 1){
$("#divCarregando").fadeIn(500);
timerId = setInterval(function () {
if(contador == 6){
$("#textoCarregando").text("Carregando......");
contador = 0;
}
if(contador == 5){
$("#textoCarregando").text("Carregando.....");
contador = 0;
}
if(contador == 4){
$("#textoCarregando").text("Carregando....");
contador = 0;
}
if(contador == 3){
$("#textoCarregando").text("Carregando...");
contador++;
}
if(contador == 2){
$("#textoCarregando").text("Carregando..");
contador++;
}
if(contador == 1){
$("#textoCarregando").text("Carregando.");
contador++;
}
if(contador == 0){
$("#textoCarregando").text("Carregando");
contador++;
}
}, 500);
}else{
clearInterval(timerId);
$("#divCarregando").fadeIn(700);
}
}
Подробнее здесь: https://stackoverflow.com/questions/787 ... on-loading
Мобильная версия