基于jQuery的圆环进度条函数封装详解编程语言
2023-06-13 09:20:24 时间
*{ margin:0; padding:0;} .div1, .right-div2, .right-div3, .left-div2, .left-div3 { width:200px; height:200px; border-radius:50%;} .div1 { background:#ccc; position:relative;} .right-div2, .right-div3, .left-div2, .left-div3 { position:absolute; left:0; top:0;} .right-div2, .right-div3 { clip:rect(0,auto,auto,100px);} .left-div2, .left-div3 { clip:rect(0,100px,auto,auto);} .right-div3 { background:#f00; transform:rotate(-180deg);} .left-div3 { background:#f00; transform:rotate(-180deg);} .div4 { position:absolute; top:25px; left:25px; width:150px; height:150px; line-height:150px; text-align:center; border-radius:50%; background:#fff;} .div2 { left:300px; top:0; position:absolute; background:#ccc; width:200px; height:200px; border-radius:50%;}
js部分:
var progress = { //变量 per : 0, //0~100 per_radian : 0, //0~360 right_div : null, left_div : null, num : null, //函数 move : function (){ this.per_radian = this.per = 50 ? this.per*3.6-180 : this.per*3.6-360; if(this.per = 50){ this.right_div.css(transform,rotate( + this.per_radian + deg)); }else{ this.right_div.css(transform,rotate(0)); this.left_div.css(transform,rotate( + this.per_radian + deg)); } this.num.html(this.per); }, /* *初始化 *参数1:进度 *参数2:右边的旋转对象 *参数3:左边的旋转对象 *参数4:显示进度的对象 */ init : function(per, right, left, num){ this.per = per; this.right_div = right; this.left_div = left; this.num = num; this.move(); } //调用 progress.init(90, $(.div1 .right-div3), $(.div1 .left-div3), $(.div1 .div4 span)); progress.init(30, $(.div2 .right-div3), $(.div2 .left-div3), $(.div2 .div4 span));
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/8627.html
c相关文章
- jquery validation engine ajax验证,jQuery Validation Engine 表单验证「建议收藏」
- 10 个实用的jQuery 代码片段详解编程语言
- jQuery图片切换插件jquery.cycle.js详解编程语言
- jquery trim重写详解编程语言
- jQuery $.inArray()方法的用法
- jQuery技巧大放送学习jquery的朋友可以看下
- JQuery插件模板制作jquery插件的朋友可以参考下
- jQuery温习篇强大的JQuery选择器
- Jquery获得服务器控件值的方法小结
- jQuery验证Checkbox是否选中的代码推荐
- jQuery操作Select选择的Text和Value(获取/设置/添加/删除)
- jQuery学习笔记(2)--用jquery实现各种模态提示框代码及项目构架
- JQuery中关于jquery.js与jquery.min.js的比较探讨
- jQuery焦点图切换特效插件封装实例
- jQuery三击事件实现代码
- jQuery取得select选择的文本与值的示例
- 利用JQuery制作符合Web标准的QQ弹出消息
- jquery数组封装使用方法分享(jquery数组遍历)
- Jquery倒计时源码分享
- jQuery根据ID获取input、checkbox、radio、select的示例