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 ...
随机推荐
- php curl 多线程方法
<?php /** * curl 多线程 * @param array $array 并行网址 * @param int $timeout 超时时间 * @return array */ fun ...
- .net一般处理程序(httphandler)实现文件下载功能
Handler文件代码如下: public class MDMExporterWeb : IHttpHandler { public void ProcessRequest(HttpContext c ...
- 菜鸟笔记:javascript基础之表达式和运算符
4.1 原始表达式 原始表达式是最简单的表达式~它不再包含其他表达式.它包含:直接量(程序中直接显示出来的数据值.)常量(程序中不会被修改的量)变量. 4.2 对象和数组的初始化表达式 对象和数组初始 ...
- LUA中将未分类数据分为测试集和训练集
require 'torch' require 'image' local setting = {parent_root = '/home/pxu/image'} function list_chil ...
- websocket业务代码
需求 用户登陆后,服务器实时推送用户的订单提醒,用websocket处理. 方案 两个js,notify-socket.js处理socket的连接,和socket的处理. nofify.js,做右下角 ...
- 排序之----插入排序(C#实现)
算法步骤:(从小到大) 1:将第一个元素与第二个元素比较大小,如果第一个元素小于等于第二个元素,不做处理,继续比较第二个元素和第三个元素. 如果第三个元素小于第二个元素,保存要移动的元素(第三个元素) ...
- iOS 修改状态栏preferredStatusBarStyle不执行问题
一.在老版本的iOS中,状态栏永远都是白色风格.而在iOS 7中,我们可以修改每个view controller中状态栏的外观.通过UIStatusBarStyle常量可以指定状态栏的内容是暗色或亮色 ...
- 关于python数据序列化的那些坑
-----世界上本来没那么多坑,python更新到3以后坑就多了 无论哪一门语言开发,都离不了数据储存与解析,除了跨平台性极好的xml和json之外,python要提到的还有自身最常用pickle模块 ...
- wpf——三维学习1
以下xmal是我从msdn上复制下来的.是用于在wpf中创建3d模型的实例链接https://msdn.microsoft.com/zh-cn/library/ms747437.aspx看它的使用方式 ...
- hadoop2.6.4 搭建单机模式
注(要先安装jdk,最好jdk版本>=1.7) 安装jdk http://www.cnblogs.com/zhangXingSheng/p/6228432.html 给普通用户添加su ...