zoukankan      html  css  js  c++  java
  • 钟表

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>时钟</title>
    </head>
    <style>
    *{
    margin: 0;
    padding: 0
    }
    .clockBox{
    200px;
    height: 200px;
    border:3px solid #000;
    border-radius: 50%;
    margin: 100px auto;
    position: relative;
    }
    .clockIco{
    200px;
    height: 200px;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1
    }
    .clockIco span{
    2px;
    height: 6px;
    background: #666;
    position: absolute;
    left: 99px;
    top: 0px;
    -webkit-transform-origin:0 100px;
    -moz-transform-origin:0 100px;
    -o-transform-origin:0 100px;
    transform-origin:0 100px;
    }
    .clockIco span:nth-child(5n+1){
    background: #000;
    3px;
    }
    .clockMove{
    200px;
    height: 200px;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 5;
    }
    .clockMove .cSpeck{
    10px;
    height: 10px;
    background: #000;
    border-radius: 50%;
    position: absolute;
    left: 50%;
    top: 50%;
    margin: -5px 0 0 -5px;
    z-index: 10;
    }
    .clockMove .iSec{
    2px;
    height: 80px;
    background: #aaa;
    position: absolute;
    left: 4px;
    bottom: 5px;
    z-index: 7;
    -webkit-transform-origin:bottom;
    -moz-transform-origin:bottom;
    -o-transform-origin:bottom;
    -ms-transform-origin:bottom;
    transform-origin:bottom;
    }
    .clockMove .iMinu{
    3px;
    height: 70px;
    background: #333;
    position: absolute;
    bottom: 5px;
    left: 3px;
    z-index: 6;
    -webkit-transform-origin:bottom;
    -moz-transform-origin:bottom;
    -o-transform-origin:bottom;
    -ms-transform-origin:bottom;
    transform-origin:bottom;
    }
    .clockMove .iHour{
    6px;
    height: 50px;
    background: #000;
    position: absolute;
    left:2px;
    bottom: 5px;;
    z-index: 5;
    -webkit-transform-origin:bottom;
    -moz-transform-origin:bottom;
    -o-transform-origin:bottom;
    -ms-transform-origin:bottom;
    transform-origin:bottom;
    }
    </style>
    <script type="text/javascript" src="http://static.cheduoshao.com/js/jquery.1.8.2.min.js"></script>
    <script>
    $(function()
    {
    addIsec();

    function addIsec()
    {
    var str = '';
    for(var i=0; i<60; i++)
    {
    str+="<span style='-webkit-transform:rotate("+6*i+"deg);-moz-transform:rotate("+6*i+"deg);-o-transform:rotate("+6*i+"deg);-ms-transform:rotate("+6*i+"deg);transform:rotate("+6*i+"deg)'></span>"
    }
    $(".clockIco").html(str);
    }
    timeMove();

    setInterval(function()
    {
    timeMove()
    },1000)

    function timeMove()
    {
    var oDate = new Date();

    var iSec = oDate.getSeconds();
    var iMin = oDate.getMinutes()+iSec/60;
    var iHour =(oDate.getHours()%12)+iMin/60;

    $(".iHour").css(
    {
    '-webkit-transform':'rotate('+(iHour*360/12)+'deg)',
    '-moz-transform':'rotate('+(iHour*360/12)+'deg)',
    '-o-transform':'rotate('+(iHour*360/12)+'deg)',
    '-ms-transform':'rotate('+(iHour*360/12)+'deg)',
    'transform':'rotate('+(iHour*360/12)+'deg)'
    })
    $(".iMinu").css(
    {
    '-webkit-transform':'rotate('+(iMin*360/60)+'deg)',
    '-moz-transform':'rotate('+(iMin*360/60)+'deg)',
    '-o-transform':'rotate('+(iMin*360/60)+'deg)',
    '-ms-transform':'rotate('+(iMin*360/60)+'deg)',
    'transform':'rotate('+(iMin*360/60)+'deg)'
    })
    $(".iSec").css(
    {
    '-webkit-transform':'rotate('+(iSec*360/60)+'deg)',
    '-moz-transform':'rotate('+(iSec*360/60)+'deg)',
    '-o-transform':'rotate('+(iSec*360/60)+'deg)',
    '-ms-transform':'rotate('+(iSec*360/60)+'deg)',
    'transform':'rotate('+(iSec*360/60)+'deg)'
    })

    }

    })
    </script>
    <body>
    <div class="clockBox">
    <div class="clockIco"></div>
    <div class="clockMove">
    <div class="cSpeck">
    <div class="iSec"></div>
    <div class="iMinu"></div>
    <div class="iHour"></div>
    </div>
    </div>
    </div>
    </body>
    </html>

  • 相关阅读:
    Mac版sublime text右键open in browser 不能识别中文名解决办法
    python 内置函数
    python 迭代器 生成器 列表推导式和生成器表达式
    python 闭包
    python 练习题
    python 打印扑克牌练习题
    python 函数 可变数据类型默认值
    python min() ,max()
    python 九九乘法表
    函数的进阶
  • 原文地址:https://www.cnblogs.com/lixiaoxing/p/4990716.html
Copyright © 2011-2022 走看看