JS+CSS 钟表
.<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
#wrap{
width: 580px;
height: 580px;
border-radius: 50%;
background: linear-gradient(to bottom,white 0px, gray 500px, white);
position: relative;
margin: 100px auto;
}
#content{
width: 500px;
height: 500px;
border-radius:50% ;
background-color: black;
position: absolute;
top: 40px;
left: 40px;
}
#second{
width:2px;
height: 200px;
position: absolute;
left: 249px;
bottom:250px;
background-color: white;
transform-origin:bottom center ;
}
#minute{
width:4px;
height: 160px;
position: absolute;
left: 248px;
bottom: 250px;
background-color: deeppink;
transform-origin:bottom center ;
}
#hour{
width:4px;
height: 120px;
position: absolute;
left: 248px;
bottom: 250px;
background-color:red;
transform-origin:bottom center ;
}
.num{
width: 500px;
height: 40px;
position: absolute;
left: 0px;
top:230px;
}
span{
display: block;
line-height: 40px;
text-align: center;
color: white;
width: 40px;
height: 40px;
}
.div1{
width: 500px;
height: 2px;
position: absolute;
left: 0;
top: 249px;
}
.div2{
width: 8px;
height: 2px;
background-color: white;
}
</style>
</head>
<body>
<div id="wrap">
<div id="content">
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="div1">
<div class="div2"></div>
</div>
<div class="num" ><span>9</span></div>
<div class="num"><span>10</span></div>
<div class="num"><span>11</span></div>
<div class="num"><span>12</span></div>
<div class="num"><span>1</span></div>
<div class="num"><span>2</span></div>
<div class="num"><span>3</span></div>
<div class="num"><span>4</span></div>
<div class="num"><span>5</span></div>
<div class="num"><span>6</span></div>
<div class="num"><span>7</span></div>
<div class="num"><span>8</span></div>
<div id="second"></div>
<div id="minute"></div>
<div id="hour"></div>
</div>
</div>
</body>
<script type="text/javascript">
//表盘
var div1=document.getElementsByClassName('div1')
for(var i = 0;i<div1.length;i++){
div1[i].style.transform="rotate("+i*6+'deg)'
}
var div2=document.getElementsByClassName('div2')
for(var i = 0;i<div1.length;i+=5){
div2[i].style.width='13px';
div2[i].style.height='3px'
}
//表盘数字
var num=document.getElementsByClassName('num');
var spanNum = document.getElementsByTagName("span");
for(var i=0;i<num.length;i++){
num[i].style.transform="rotate("+i*30+'deg)'
}
for(var i=0;i<spanNum.length;i++){
spanNum[i].style.transform="rotate("+i*-30+'deg)'
}
var second = document.getElementById('second');
var minute = document.getElementById('minute');
var hour = document.getElementById('hour');
function ColorNumber() {
var Houre = document.getElementById("hour");
var Minute = document.getElementById("minute");
var Second = document.getElementById("second");
var nowTime = new Date();
var nowHoure = nowTime.getHours();
var nowMinute = nowTime.getMinutes();
var nowSecond = nowTime.getSeconds();
var houreDeg = (nowMinute / 60) * 30;
var minuteDeg = (nowSecond / 60) * 6;
Houre.style.WebkitTransform = "rotate(" + (nowHoure * 30 + houreDeg) + "deg)";
Minute.style.WebkitTransform = "rotate(" + (nowMinute * 6 + minuteDeg) + "deg)";
Second.style.WebkitTransform = "rotate(" + (nowSecond * 6) + "deg)";
}
ColorNumber();
setInterval(ColorNumber, 1000);
</script>
</html>
JS+CSS 钟表的更多相关文章
- electron之Windows下使用 html js css 开发桌面应用程序
1.atom/electron github: https://github.com/atom/electron 中文文档: https://github.com/atom/electron/tree ...
- JS/CSS缓存杀手——VS插件
背景 前些天去考科目二,感觉经历了一场不是高考却胜似高考的考试(10年前的5分之差, 还是难以释怀)! 一行八人,就我学的时间最少(4天,8人一辆车),教练都觉得我肯定还得再来一次! 靠着运气和 ...
- gulp实现打包js/css/img/html文件,并对js/css/img文件加上版本号
参考打包教程: http://www.cnblogs.com/tugenhua0707/p/4069769.html http://www.cnblogs.com/tugenhua0707/p/498 ...
- 配置springMVC之后,引入js,css等资源处理
配置了sringMVC之后,要引入js,css处理: 做法1:在<%page %>下面增加: <%@ taglib prefix="yesurl" uri=&qu ...
- springmvc js/css路径问题
①No mapping found for HTTP request with URI[/msm2/css/login2.css] in DispatcherServlet with name 'sp ...
- iOS之在webView中引入本地html,image,js,css文件的方法 - sky//////////////////////////////////////ZZZZZZZZZZZZZZZ
iOS之在webView中引入本地html,image,js,css文件的方法 2014-12-08 20:00:16CSDN-sky_2016-点击数:10292 项目需求 最近开发的项 ...
- springMVC下jsp引用外部js,css等静态资源的解决方法
直入主题. 1. web.xml对springMVC配置如下: <servlet> <description>Spring MVC配置</description> ...
- 在Sublime Text 3 中安装SublimeLinter,Node.js进行JS&CSS代码校验
转载自:http://www.wiibil.com/website/sublimelinter-jshint-csslint.html 在Sublime Text中安装SublimeLinter,No ...
- 使Eclipse下支持编写HTML/JS/CSS/JSP页面的自动提示。
我们平时用eclipse开发jsp页面时智能提示效果不太理想,今天用了两个小时发现了eclipse也可以像Visual Studio 2008那样完全智能提示HTML/JS/CSS代码,使用eclip ...
随机推荐
- CentOS 6.5 编译 PHP-7 报错:undefined reference to `libiconv_open 无法编译 PHP libiconv
./configure --with-mysql=/backup/mysql --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zli ...
- .net mvc中的表单异步提交
// // 摘要: // 将 <form> 开始标记写入响应. // // 参数: // ajaxHelper: // AJAX 帮助器. // // actionName: // 将处理 ...
- GSM07.10协议中串口复用使用的校验算法
] = { 0x00, 0x91, 0xE3, 0x72, 0x07, 0x96, 0xE4, 0x75, 0x0E, 0x9F, 0xED, 0x7C, 0x09, 0x98, 0xEA, 0x7B ...
- python raise a string exception is deprecated
python不允许raise 一个内建的string 对象.所以就崩溃,可以先将其转换成其他string,比如赋值.
- PYTHON文件操作(二)
class file(object) def close(self): # real signature unknown; restored from __doc__ 关闭文件 "" ...
- spring中InitializingBean接口使用理解
InitializingBean接口为bean提供了初始化方法的方式,它只包括afterPropertiesSet方法,凡是继承该接口的类,在初始化bean的时候会执行该方法. 测试程序如下: imp ...
- java后台对前端输入的特殊字符进行转义
转自:http://www.cnblogs.com/yangzhilong/p/5667165.html java后台对前端输入的特殊字符进行转义 HTML: 常见的帮助类有2个:一个是spring的 ...
- ubuntu 12.04 install docker-engine1.12.3
root@node3:/data/src# cat /etc/issueUbuntu 12.04.4 LTS \n \l root@node3:/data/src# cat /etc/apt/so ...
- connect mysql from another host
vim /etc/mysql/my.cnf bind-address = 0.0.0.0 /etc/init.d/mysql restart mysql -uroot -p1234 # grant a ...
- Linux学习记录
---恢复内容开始--- linux与unix的关系 linux是借鉴了unix设计思想,也称linux位类unix系统. Linux常用命令 1.命令基本格式 命令[选项][参数] 注意:个别命令不 ...