如何使用laravel 5节省时间

时间:2017-06-21 08:11:00

标签: javascript jquery database laravel-5

我很困惑,如何节省在laravel 5中度过的时间?请参阅下面的htmljs代码:



	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;
&#13;
&#13;

0 个答案:

没有答案