扫一扫分享
jquery Timer:在任何html元素内启动/停止/恢复/删除漂亮的计时器。 特点
$("#div-id").timer(options);
要使用选项启动计时器:
$("#div-id").timer({
seconds: {Int}, // The number of seconds to start the timer from
duration: {String}, // The time to countdown from. `seconds` and `duration` are mutually exclusive
callback: {Function}, // If duration is set, this function is called after `duration` has elapsed
repeat: {Bool}, // If duration is set, `callback` will be called repeatedly
format: {String}, // Format to show time in
editable: {Bool} // If click and edit time is enabled
hidden; {Bool} // If true, the timer is not displayed in the selected item.
});
初始化计时器上可用的方法:
//pause an existing timer
$("#div-id").timer('pause');
//resume a paused timer
$("#div-id").timer('resume');
//remove an existing timer
$("#div-id").timer('remove'); //leaves the display intact
//get elapsed time in seconds
$("#div-id").data('seconds');
手机预览