Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function countdown(fecha,div) {
- var end = new Date(fecha);
- var _second = 1000;
- var _minute = _second * 60;
- var _hour = _minute * 60;
- var _day = _hour * 24;
- var timer;
- function showRemaining() {
- var nowx = new Date($("#serverTime").val());
- var distance = end - nowx;
- if (distance < 0) {
- $("#"+div).fadeOut("fast");
- clearInterval(timer);
- var $element = $("#"+div);
- var row = $($element).parents("#tableLotts tr:first");
- row.insertAfter($('#tableLotts tr').last());
- $("#"+div).fadeIn("fast");
- $("#"+div).html('<i class="fas fa-lock"></i> CLOSED');
- $(row).css('opacity','0.5');
- var checkbox = $(row).closest('tr').find('input:checkbox');
- checkbox.remove();
- var loteria = checkbox.attr("loteria");
- $("tr[lottery='"+loteria+"']").remove();
- $("input[lottery='"+loteria+"']").remove();
- $("span[mx='"+loteria+"']").remove();
- return;
- }
- var days = Math.floor(distance / _day);
- var hours = Math.floor((distance % _day) / _hour);
- var minutes = Math.floor((distance % _hour) / _minute);
- var seconds = Math.floor((distance % _minute) / _second);
- hours = ("0" + hours).slice(-2);
- minutes = ("0" + minutes).slice(-2);
- seconds = ("0" + seconds).slice(-2);
- $("#"+div).html('<i class="fas fa-lock-open"></i> '+hours+':'+minutes+':'+seconds);
- }
- timer = setInterval(showRemaining, 1000);
- }
Add Comment
Please, Sign In to add comment