H5W3
当前位置:H5W3 > 其他技术问题 > 正文

【Web前端问题】这个圆环倒计时怎么让它变细一点?有没有办法!

我想把圆环的细度调整为2px 左右 改怎么修改!原来链接在这里 http://www.veryhuo.com/a/view/44017.html

<!DOCTYPE HTML>
<html>
<head>
<meta charset="gbk">
<title></title>
<style>
.pie { width:200px; height:200px; background-color:blue; border-radius:50%; position:absolute;

 }
.pie1 { clip:rect(0px,200px,200px,100px); -o-transform:rotate(0deg); -moz-transform:rotate(0deg); -webkit-transform:rotate(0deg);  }
.pie2 { clip:rect(0px,100px,200px,0px); -o-transform:rotate(0deg); -moz-transform:rotate(0deg); -webkit-transform:rotate(0deg);  }
.hold { width:200px; height:200px; position:absolute; z-index:1; }
.hold1 { clip:rect(0px,200px,200px,100px); }
.hold2 { clip:rect(0px,100px,200px,0px); }
.bg { width:200px; height:200px; background-color:red; border-radius:100px; position:absolute; }
.time { width:160px; height:160px; margin:20px 0 0 20px; background-color:#fff; border-radius:100px; position:absolute; z-index:1; box-shadow:0px 0px 8px #333 inset; text-align:center; line-height:160px; font-family:"Book Antiqua", Palatino, serif; font-size:35px; font-weight:bold; }
.time em { background:#fff; position:absolute; top:62px; left:12px; height:18px; width:140px; opacity:0.4; }
</style>
</head>
<body>
<div class="hold hold1">
<div class="pie pie1"></div>
</div>
<div class="hold hold2">
<div class="pie pie2"></div>
</div>
<div class="bg"> </div>
<div class="time"><span></span><em></em></div>
<script src="http://www.veryhuo.com/uploads/common/js/jquery-1.7.min.js"></script>
<script>
i = 0;
j = 0;
count = 0;
MM = 0;
SS = 59;
MS = 9;
totle = (MM+1)*600;
d = 180*(MM+1);
MM = "0" + MM;
function showTime(){
totle = totle - 1;
if(totle==0){
clearInterval(s);
clearInterval(t1);
clearInterval(t2);
$(".pie2").css("-o-transform","rotate(" + d + "deg)");
$(".pie2").css("-moz-transform","rotate(" + d + "deg)");
$(".pie2").css("-webkit-transform","rotate(" + d + "deg)");
}else{
if(totle>0 && MS>0){
MS = MS - 1;
if(MS < 10){MS = "0" + MS};
};
if(MS==0 && SS>0){
MS = 10;
SS = SS - 1;
if(SS < 10){SS = "0" + SS};
};
if(SS==0 && MM>0){
SS = 60;
MM = MM - 1;
if(MM < 10){MM = "0" + MM};
};
};
$(".time span").html(MM + ":" + SS + ":" + MS);
};
s = setInterval("showTime()",100);
function start1(){
i = i + 0.6;
count = count + 1;
if(count==300){
count = 0;
clearInterval(t1);
t2 = setInterval("start2()",100);
};
$(".pie1").css("-o-transform","rotate(" + i + "deg)");
$(".pie1").css("-moz-transform","rotate(" + i + "deg)");
$(".pie1").css("-webkit-transform","rotate(" + i + "deg)");
};
function start2(){
j = j + 0.6;
count = count + 1;
if(count==300){
count = 0;
clearInterval(t2);
t1 = setInterval("start1()",100);
};
$(".pie2").css("-o-transform","rotate(" + j + "deg)");
$(".pie2").css("-moz-transform","rotate(" + j + "deg)");
$(".pie2").css("-webkit-transform","rotate(" + j + "deg)");
};
t1 = setInterval("start1()",100);
</script>
</body>
</html>

回答:

修改

.time { width:180px; height:180px; margin:10px 0 0 10px; line-height: 180px;}

这部分即可。可以理解为白色的.time部分,是遮盖在最上层,所以尺寸越接近200px(外围的尺寸),表现出来的圆环越细。
这代码的结构和方法都有很大的优化空间。

回答:

一个一个的试,把样式修改或者注释掉,就知道是哪个样式控制这个宽度。

跟楼上一样.time样式控制这个宽度,按上面修改就可以。

教程是11年的,你现在可以尝试用canvas写一个试试,应该容易很多。

本文地址:H5W3 » 【Web前端问题】这个圆环倒计时怎么让它变细一点?有没有办法!

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址