pietimer是一个可以在页面上生成一个扇形变化的定时器插件,它基于jquery,可以自定义定时时间秒数,自定义扇形的颜色、宽度和高度等,并且支持定时结束时回调函数,可以控制开始和暂停,适用于需要定时器的页面如在线考试、倒计时,限时抢购等场景。本文主要为大家详细介绍了jquery扇形定时器插件pietimer的使用方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能帮助到大家。
参数如下:

效果图:

demo代码如下:
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>pietimer-基于jQuery的扇形定时器</title>
<style type="text/css">
.start,.pause{display:block;margin:10px auto;background:#0ABF5D;border-radius:6px;width:100px;height:30px;line-height:30px;color:#fff;text-align:center}
.demo{margin:20px auto;text-align:center}
</style>
</head>
<body>
<a class="start">start开始</a>
<a class="pause">pause暂停</a>
<p class="demo"></p>
<script type="text/javascript" src="/static/lib/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="script/jquery.pietimer.min.js"></script>
<script type="text/javascript">
$(function(){
$('.demo').pietimer({
seconds: 2,
color: 'rgba(10, 191, 93, 0.8)',
height: 60,
width: 60,
//is_reversed: true //是否逆时针转
},
function(){
//回调函数
console.log("结束咯!");
});
$('.start').click(function(){
$('.demo').pietimer('start');
return false;
});
$('.pause').click(function(){
$('.demo').pietimer('pause');
return false;
});
});
</script>
</body>
</html>相关推荐:
JavaScript定时器中关于setTimeout()与setInterval()的详解
以上就是jQuery扇形定时器插件pietimer使用方法分享的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号