Есть скрипт на PROGRESS BAR в виде уровня воды в емкости .Как туда забивать рандомные числа и скрипт сам обновлялся ?
JS
$(function () {
atualizaProgresso = function () {
var percent = $('input[type=number]').val();
var atual = $('#barra-progresso .concluido').data('p');
percent = percent > 100 ? 100 : percent;
mudaNumero(atual, percent);
$('#barra-progresso .concluido').animate({
height: percent + '%'
}, {
duration: 300,
easing: "swing"
});
$('#barra-progresso .concluido').data('p', percent);
};
$('button').click(atualizaProgresso);
$('#barra-progresso .concluido').data('p', 0);
atualizaProgresso();
});
function mudaNumero(de, para) {
if (typeof timer1 == "number") {
clearInterval(timer1);
}
decimo = (para - de) / 10;
para = parseInt(para, 10);
de = parseInt(de, 10);
vezes = 1;
timer1 = window.setInterval(function () {
if (vezes == 10) {
clearInterval(timer1);
}
de = de + parseFloat(decimo, 10);
$('#barra-progresso .percentual .numero').html(Math.round(de));
vezes++;
}, 30);
}
$(document).ready(function() {
$("[data-toggle]").click(function() {
var toggle_el = $(this).data("toggle");
$(toggle_el).toggleClass("open-sidebar");
});