JS
JS
orientacion, txtPosition;
$('.blank').addClass('blank-v');
$('.porcentaje').addClass('porcentaje-v');
$(".bar").addClass('bar-v');
$(".inside").addClass('inside-v');
} else if(orientacion === "horizontal") {
$('.blank').removeClass('blank-v');
$('.porcentaje').removeClass('porcentaje-v');
$(".bar").removeClass('bar-v');
$(".inside").removeClass('inside-v');
$('.blank').addClass('blank-h');
$('.porcentaje').addClass('porcentaje-h');
$(".bar").addClass('bar-h');
$(".inside").addClass('inside-h');
}
updateBar(count);
});
function updateBar(count) {
if (count === prevCount) return;
clearTimeout(timeout);
prevCount = count;
console.log(count);
$("body").fadeTo("slow", 1);
let percentage = Math.min(100, (count / goal * 100).toPrecision(3));
// if(percentage > 100) percentage = 100;
$('#bar').css('clip', "rect(0px," + width + "px,"+((percentage/100 * height))
+"px,0px)");
$("#count").html(count);
if (fieldData.fadeoutAfter) {
timeout = setTimeout(() => {
$("body").fadeTo("slow", 0);
}, fieldData.fadeoutAfter * 1000)
}
console.log(count + ' ' + goal);
let p = (count/goal)*100;
let blank = (100-p) + '%';
let por = p + '%';
if(orientacion === "vertical") {
$('#blank').height(blank);
$('#porcentaje').height(por);
if (fieldData['eventType'] === 'tip') {
count = count.toLocaleString(userLocale, {style: 'currency', currency:
currency})
}
$("#val").html(count + '/' + goal + '<br> ');
} else if(orientacion === "horizontal") {
$('#blank').width(blank);
$('#porcentaje').width(por);
if (fieldData['eventType'] === 'tip') {
count = count.toLocaleString(userLocale, {style: 'currency', currency:
currency})
}
$("#val").html(count + '/' + goal + ' ');
}