动态显示百分圆

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Examples</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<style>
.circle {
width: 200px;
height: 200px;
position: relative;
float:left;
border-radius: 50%;
background: #F64E58;
overflow: hidden;
}
.pie_left, .pie_right {
width: 200px;
height: 200px;
position: absolute;
top: 0;left: 0;
}
.left, .right {
width:200px;
height:200px;
background:#C3C3C3;
border-radius: 50%;
position: absolute;
top: 0;
left: 0;
transition: all 2s linear; }
.left{transition: all 2s linear .5s;} .right{
/* transform: rotate(30deg);*/
}
.pie_right, .right {
clip:rect(0,auto,auto,100px);
}
.pie_left, .left {
clip:rect(0,100px,auto,0);
}
.theValue {
width: 180px;
height: 180px;
border-radius: 50%;
top: 10px;
left: 10px;
background: white;
position: absolute;
text-align: center;
line-height: 180px;
font-size: 20px;
color: #F64E58; }
</style>
</head>
<body>
<div class="circle">
<div class="pie_left"><div class="left"></div></div>
<div class="pie_right"><div class="right"></div></div>
<div class="theValue"><span class="vauNum">81</span>%</div>
</div>
<div class="circle">
<div class="pie_left"><div class="left"></div></div>
<div class="pie_right"><div class="right"></div></div>
<div class="theValue"><span class="vauNum">20</span>%</div>
</div>
<script type="text/javascript">
$(function() {
$('.circle').each(function(index, el) {
var num = $(this).find('.vauNum').text() * 3.6;
if (num<=180) { $(this).find('.right').animate({
aa:num
},{
step:function(now,fx){ $(this).css('transform', "rotate(" +now + "deg)");
},
duration:1500
})
} else{ var that=$(this).find('.right');
that.css('transform', "rotate(180deg)");
$(this).css('transform', "rotate(0deg)");
$(this).find('.left').animate({
cc:num-180 },{
step:function(now,fx){
console.log(now+"ccc"); //参数step:规定每个动画的每一步完成之后要执行的函数
// now:是当前动画正在改变的属性的实时值;
// fx: jQuery.fx 原型对象的一个引用,其中包含了多项属性,比如
// 执行动画的元素:elem;
// 动画正在改变的属性:prop;
// 正在改变属性的当前值:now;
// 正在改变属性的结束值:end;
// 正在改变属性的单位:unit;等
// 可在这里改变animate第1个参数中设置的属性bb在动画结束时的值 $(this).css('transform', "rotate(" + (now) + "deg)"); },
duration:1500
}) };
}); });
</script>
</body> </html>

jquery、css3动态显示百分比圆的更多相关文章

  1. css3圆形百分比进度条的实现原理

    原文地址:css3圆形百分比进度条的实现原理 今天早上起来在查看jquery插件机制的时候,一不小心点进了css3圆形百分比进度条的相关文章,于是一发不可收拾,开始折腾了... 关于圆形圈的实现,想必 ...

  2. 8款超酷体验的jQuery/CSS3应用插件

    1.jQuery/CSS3实现Android Dock菜单效果 这是一款基于jQuery和CSS3的Android Dock菜单效果,点击底部的按钮即可让应用图标浮动上来,并且按钮也出现3D的翻转效果 ...

  3. 9款超酷的jQuery/CSS3插件

    Article From here: http://js.itivy.com/?p=1883 1.jQuery向前滑动切换焦点图 这款jQuery焦点图非常绚丽,切换图片的时候每张图片是向前滑动的,很 ...

  4. jQuery+CSS3文字跑马灯特效

    jQuery+CSS3文字跑马灯特效是一款将跑马灯背景制作为3D立方体效果,文字在上面移动时,就像是文字投影到墙壁上,在转角出会改变运动方向. 效果展示 http://hovertree.com/te ...

  5. jquery css3问卷答题卡翻页动画效果

    这个选项调查的特效以选项卡的形式,每答完一道题目自动切换到下一条,颇具特色.使用jQuery和CSS3,适合HTML5浏览器. 效果展示 http://hovertree.com/texiao/jqu ...

  6. jQuery css3鼠标悬停图片显示遮罩层动画特效

    jQuery css3鼠标悬停图片显示遮罩层动画特效 效果体验:http://hovertree.com/texiao/jquery/39/ 效果图: 源码下载:http://hovertree.co ...

  7. 使用 jQuery & CSS3 制作美丽的照片画廊

    在本教程中,我们将创建一个很好看的照片画廊效果.我们的想法是,以显示专辑作为一个滑块,而当这张专辑被选中,我们将使用一个美丽的照片堆栈展示专辑的图像.在照片堆栈视图,我们可以通过将最上面的图像移动到所 ...

  8. jQuery+css3 弹幕

    写了个基于jQuery+css3的弹幕功能,此功能面向手机wap,利用改变位移做弹幕功能会使一些性能低的手机浏览器卡,所以用了css3,此功能不支持非webkit内核浏览器 html部分 自己设置样式 ...

  9. Image Wall - jQuery & CSS3 图片墙效果

    今天我们要为您展示如何基于 jQuery 和 CSS3 创建一个整洁的图片墙效果.我们的想法是在页面上洒上一些大小不同的缩略图,并在当我们点击图片时候显示丝带,会显示一些描述,再次点击缩略图时,丝带将 ...

随机推荐

  1. SST:Single-Stream Temporal Action Proposals论文笔记

    SST:Single-Stream Temporal Action Proposals 这是本仙女认认真真读完且把算法全部读懂(其实也不是非常懂)的第一篇论文 CVPR2017 一作 论文写作的动机m ...

  2. 第1章 Python基础

    一.安装Python windows: 1.下载安装包     https://www.python.org/downloads/ 2.安装     默认安装路径:C:\python27 3.配置环境 ...

  3. js操作对象属性值为字符串

    今天在项目开发中遇到一个没遇到过的问题,这个问题是需要对比两个对象a和b,a是一个只有一个属性的对象,b是一个含有多个属性对象,如果b中包含和a一模一样的属性名和值,则把这个一样的属性和值从b中删除了 ...

  4. oracle数据库 expdp/impdp 和 exp/imp

    --EXPDP导出,需要系统用户权限,一般不使用--sqlplus--1.创建dmp导出逻辑目录 create directory 目录名 as '目录路径' create directory exp ...

  5. C++ Primer Plus学习:第十五章

    第十五章 友元.异常和其他 友元 友元类 表 0-1 class Tv { public: friend class Remote; } Remote类可以使用Tv的数据成员,Remote类在Tv类后 ...

  6. eclipse取消validation验证

    点击按钮如下:window-Preferences-Validation.如图. 然后把build里面的都取消.即可.

  7. IT行业所面临的问题

    在阅读了“2015 IT行业大学生就业分析报告”和“2014年十大最热门行业和职业排行榜 IT行业最吃香_联展新闻”两则新闻后,我决定用一篇和老师对话的形式来表达我的感受. dym:人潮汹涌的招聘市场 ...

  8. 这些天php面试的总结

    面试总结 记录一些本人在面试中遇到的觉得有些掌握不好的面试题,下面的答案都是本人回答的,如果哪里不对的话,希望各位能够指出. 1.Git fetch和git pull的区别 Git fetch相当于从 ...

  9. ADO.NET DBHelper 类库

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.D ...

  10. js & enter

    js & enter keycode function (e) { if (e.which === 13 || e.keyCode === 13) { //code to execute he ...