Home>
jquery.fn.countdown=function (settings, to) {
  settings=jquery.extend ({
    startfontsize:"36px",    endfontsize:"12px",    duration:1000,    startnumber:10,    endnumber:0,    callback:function () {}
  }, settings);
  return this.each (function () {
    //where do we start?
    if (! to &&!=settings.endnumber) {to=settings.startnumber;}
    //set the countdown to the starting number
    $(this) .text (to) .css ("fontsize", settings.startfontsize);
    //loopage
    $(this) .animate ({
      "fontsize":settings.endfontsize
    }, settings.duration, "", function () {
      if (to>settings.endnumber + 1) {
        $(this) .css ("fontsize", settings.startfontsize) .text (to-1).
 countdown (settings, to-1);
      }
      else
      {
        settings.callback (this);
      }
    });
  });
};
/* sample usage
//call method
//
$("#countdown"). countdown ({
  startnumber:10,  callback:function (me) {
    $(me) .text ("Countdown is loaded"). css ("color", "#090");
  }
});
  • Previous php file upload class complete example
  • Next ThinkPHP 322 way to achieve persistent login (remember me) function