我很困惑,如何节省在laravel 5中度过的时间?请参阅下面的html
和js
代码:
var quiz_timer = $('.quiz-timer').html();
var exact_time = parseInt($('.timer-value').html() - 1);
var befores = 60;
var setters = setInterval(function(){
var zero_check = (exact_time == 0) ? '0' : '';
var zero_check_sec = (befores < 10) ? '0' : '';
var new_seconds = $('.quiz-timer').html(zero_check + exact_time.toString() + ':'+ zero_check_sec + --befores);
if(exact_time == 00 && befores == 00){
clearInterval(setters);
alert('Time is up!');
}
if(befores == 0){
exact_time--;
befores = 60;
}
}, 10);
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span class="quiz-timer">
<span class="timer-value">2</span>:00
</span>
&#13;