こんにちはすべて私はブートストラップ4の各進捗バーの制限を設定しようとしています。 私はそれがクリックでトリガーしたい。今まで私、私は、各プログレスバーの最大値を設定するにはどうすればよい値は常に100になりどのように制限値を設定する - jquery
クリックしたときに
問題がありますか?
ここにコードがあります。あなたがそこにあなたのためにそれを行うことがare、plenty、of、librariesをプログレスバーが必要な場合は
<button>run</button>
<progress class="progress progress-striped progress-animated limit70" value="" max="100"></progress>
<progress class="progress progress-striped progress-animated limit80" value="" max="100"></progress>
$('button').on('click', function() {
$('.progress').each(function() {
var progBar = $(this);
var perc = progBar.attr("max");
var userInput = $('input#speed').val(); // in seconds
var speed = userInput * 10;
var currentPerc = 0;
var progress = setInterval(function() {
if (currentPerc >= perc) {
clearInterval(progress);
} else {
currentPerc += 1;
progBar.attr('value', (currentPerc) + '');
}
progBar.attr((currentPerc) + '');
}, speed);
});
});
はここfiddle
? –
はプラグインを使用していません。私は、ブートストラップ4のプログレスバーを使って、そのjqueryを追加してアニメーションをトリガーしました。 –