Resimdeki Gibi Zaman Barı Yapmak İstiyorum, İnternetten Bulduğum Bir Kod Var Çalışıyor Ancak Arka Planda Kendini Devam Ettirmiyor.
Kod:
<div id="progressBar"> <div></div> </div>
<script type="text/javascript">
function progress(timeleft, timetotal, $element) {
var progressBarWidth = timeleft * $element.width() / timetotal;
$element.find('div').animate({ width: progressBarWidth }, 500).html();
if(timeleft > 0) {
setTimeout(function() {
progress(timeleft - 1, timetotal, $element);
}, 1000);
}
else{
$('#statistiek').css('display', 'inline');
}
};
progress(1800, 1800, $('#progressBar'));
</script>
#progressBar{
width: 90%;
margin: 10px auto;
height: 8px;
background-color: #333;
border-radius: 5px;
}
#progressBar div{
height: 100%;
text-align: right;
padding: 0 10px;
color: #000;
line-height: 12px; /* same as #progressBar height if we want text middle aligned */
width: 0;
font-size: 12px;
background-color: #ffff00;
border-radius: 5px;
box-sizing: border-box;
}
Kullandığım Kod Bu Ancak Dediğim Gibi Arka Planda Çalışmıyor Tarayıcı Vs Değiştirdiğimde Kodun Çalışması Duruyor
Arka Planda Da Çalışacak Şekilde Nasıl Yapabilirim ?