The examples in this article describe jquery's approach to the simple implementation of the countdown function based on extensions. Share to everyone for your reference, specific as follows:
JQuery.fn.countDown = function (settings,to) {settings = Jquery.extend ({startfontsize: ' 36px ', endfontsize: ' 1
2px ', duration:1000, Startnumber:10, endnumber:0, Callback:function () {}}, settings);
Return This.each (function () {//where do we start?
if (!to && 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
> 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 loaded
CSS (' Color ', ' #090 ');
}
});
More interested readers of jquery-related content can view the site: "jquery date and time Operation tips Summary", "jquery switching effects and techniques summary", "jquery drag-and-drop effect and Skills summary", "JQuery Extended Skills Summary", " jquery Common Classic Effects Summary "jquery animation and special effects usage Summary", "jquery selector usage Summary" and "jquery common Plug-ins and Usage summary"
I hope this article will help you with the jquery program design.