關於jquery插件jTimer(jquery定時器)使用方法

複製代碼 代碼如下:

關於jquery插件jTimer(jquery定時器)使用方法

(function ($) {

$nd({

timer: function (action,context,time) {

var _timer;

if ($nction(action)) {

(function () {

_timer = setInterval(function () {

if (!action(context)) {

clearInterval(_timer);

}

}, time);

})();

}

}

});

})(jQuery);

複製代碼 代碼如下:

#wrap

{

display: table;

margin: 0 auto;

}

#cvs

{

display: table-cell;

vertical-align: middle;

}

function drawRound(context) {

if (terclockwise) {

draw(context.x, context.y, context.r, t, t - / 50, terclockwise);

t -= / 50;

return t > 0.5 * ;

}

else {

draw(context.x, context.y, context.r, t, t + / 50, terclockwise);

t += / 50;

return t < ;

}

}

function draw(x, y, r, sAngle, eAngle, counterclockwise) {

var cvs = lementById("cvs");

ctx = ontext("2d");

keStyle = "#f00";

nPath();

(x, y, r, sAngle, eAngle, counterclockwise);

ke();

}

$(function () {

$r(drawRound, { x: 100, y: 100, r: 50, start: 1.5 * , counterclockwise: true }, 200);

$r(drawRound, { x: 100, y: 100, r: 60, start: 0, counterclockwise: false }, 200);

});