Copy Code code as follows:
$ (document). Ready (function () {
/* Delay Function * *
JQuery.fn.delay = function (time, func) {
Return This.each (function () {
SetTimeout (func, time);
});
};
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 () {
if (!to && to!= settings.endnumber) {to = Settings.startnumber;}
Set the number of Countdown start
$ (this). Text (To). CSS (' fontsize ', settings.startfontsize);
Page animation
$ (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);
}
});
});
};
Use
$ (' #countdown '). Countdown ({
Startnumber:10,
Callback:function (Me) {
$ (Me). Text (' All done! This is where you give the reward! '). CSS (' Color ', ' #090 ');
}
});
});