Skip to main content
English
Source Link
RTOSkit
  • 248
  • 3
  • 13

I do not quite understand, why in your code had so many passages from date to date,?
if your "tag attribute" was already formed in thewith a correct date? format.

I've done some adjustments in the source code, I've tested and I do not see any kind of delay in the source code or in the plugin.

This is the source code and you can see it working in livetest here:

I do not quite understand, why in your code had so many passages from date to date,
if your "tag attribute" was already formed in the correct date?

I've done some adjustments in the code, I've tested and I do not see any kind of delay in the code or in the plugin.

This is the code and can see it working in live here:

I do not quite understand, why in your code had so many passages from date to date?
if your "tag attribute" was already with a correct date format.

I've done some adjustments in the source code, I've tested and I do not see any kind of delay in the source code or in the plugin.

This is the source code and you can test here:

change example code from "simple mode" to "mixed mode"
Source Link
RTOSkit
  • 248
  • 3
  • 13
function init_countdown(id,element,datetime,fullmode){
    var endDate = datetime;
    if(!fullmode){
       $(element).countdown({ date: endDate });
    }else{
        $(element).countdown({
          date: endDate,
          render: function(data) {
            var el = $(this.el);
            el.empty()
              .append("<div>" + this.leadingZeros(data.years, 4) + " <span>years</span></div>")
              .append("<div>" + this.leadingZeros(data.days, 3) + " <span>days</span></div>")
              .append("<div>" + this.leadingZeros(data.hours, 2) + " <span>hrs</span></div>")
              .append("<div>" + this.leadingZeros(data.min, 2) + " <span>min</span></div>")
              .append("<div>" + this.leadingZeros(data.sec, 2) + " <span>sec</span></div>");
          }
        });
    }
 }


$(function(){
  var mode=1;
  $.each($('.countdown'), function() {
    var _element = '.countdown-'+$(this).attr("id");
    var _id = $(this).attr("id");
    if($(_element).length > 0){
      var _datetime = $(_element).attr('data-expiration');
      init_countdown(_id,_element,_datetime,false(mode^=1));
    }
  });
});
function init_countdown(id,element,datetime,fullmode){
    var endDate = datetime;
    if(!fullmode){
       $(element).countdown({ date: endDate });
    }else{
        $(element).countdown({
          date: endDate,
          render: function(data) {
            var el = $(this.el);
            el.empty()
              .append("<div>" + this.leadingZeros(data.years, 4) + " <span>years</span></div>")
              .append("<div>" + this.leadingZeros(data.days, 3) + " <span>days</span></div>")
              .append("<div>" + this.leadingZeros(data.hours, 2) + " <span>hrs</span></div>")
              .append("<div>" + this.leadingZeros(data.min, 2) + " <span>min</span></div>")
              .append("<div>" + this.leadingZeros(data.sec, 2) + " <span>sec</span></div>");
          }
        });
    }
 }


$(function(){
  $.each($('.countdown'), function() {
    var _element = '.countdown-'+$(this).attr("id");
    var _id = $(this).attr("id");
    if($(_element).length > 0){
      var _datetime = $(_element).attr('data-expiration');
      init_countdown(_id,_element,_datetime,false);
    }
  });
});
function init_countdown(id,element,datetime,fullmode){
    var endDate = datetime;
    if(!fullmode){
       $(element).countdown({ date: endDate });
    }else{
        $(element).countdown({
          date: endDate,
          render: function(data) {
            var el = $(this.el);
            el.empty()
              .append("<div>" + this.leadingZeros(data.years, 4) + " <span>years</span></div>")
              .append("<div>" + this.leadingZeros(data.days, 3) + " <span>days</span></div>")
              .append("<div>" + this.leadingZeros(data.hours, 2) + " <span>hrs</span></div>")
              .append("<div>" + this.leadingZeros(data.min, 2) + " <span>min</span></div>")
              .append("<div>" + this.leadingZeros(data.sec, 2) + " <span>sec</span></div>");
          }
        });
    }
 }


$(function(){
  var mode=1;
  $.each($('.countdown'), function() {
    var _element = '.countdown-'+$(this).attr("id");
    var _id = $(this).attr("id");
    if($(_element).length > 0){
      var _datetime = $(_element).attr('data-expiration');
      init_countdown(_id,_element,_datetime,(mode^=1));
    }
  });
});
Bounty Ended with 100 reputation awarded by CommunityBot
added 151 characters in body
Source Link
RTOSkit
  • 248
  • 3
  • 13

This is the code and can see it working in live herehere:


This is the code and can see it working in live here

This is the code and can see it working in live here:


deleted 3 characters in body
Source Link
RTOSkit
  • 248
  • 3
  • 13
Loading
Source Link
RTOSkit
  • 248
  • 3
  • 13
Loading