Home >Web Front-end >JS Tutorial >Sharing how to use the jQuery sector timer plug-in pietimer
Pietimer is a timer plug-in that can generate a fan-shaped change on the page. It is based on jQuery and can customize the timing time in seconds, customize the fan-shaped color, width and height, etc., and supports a callback function when the timing ends. You can control the start and pause, which is suitable for pages that require timers, such as online exams, countdowns, limited-time sales, etc. This article mainly introduces in detail how to use the jQuery sector timer plug-in pietimer. It has certain reference value. Interested friends can refer to it. I hope it can help everyone.
The parameters are as follows:
Rendering:
The demo code is as follows:
<!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>
Related recommendations:
js timer to implement simple animation effects
The above is the detailed content of Sharing how to use the jQuery sector timer plug-in pietimer. For more information, please follow other related articles on the PHP Chinese website!