변환의 시계 구현

11119 단어
배운 지식을 더욱 잘 활용하고, 지식을 튼튼히 하며, 훗날 복습도 편리하게 하기 위해서는 어떤 것들을 해서 몸을 풀어야 한다
다음은 구현된 코드입니다.


    
        
        

        <style type="text/css">
            *</span>{<span style="color: #ff0000;">
                margin</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;">
                padding</span>:<span style="color: #0000ff;"> 0</span>;
            }<span style="color: #800000;">
            #wrap</span>{<span style="color: #ff0000;">
                width</span>:<span style="color: #0000ff;"> 200px</span>;<span style="color: #ff0000;">
                height</span>:<span style="color: #0000ff;"> 200px</span>;<span style="color: #ff0000;">
                position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;">
                left</span>:<span style="color: #0000ff;"> 50%</span>;<span style="color: #ff0000;">
                top</span>:<span style="color: #0000ff;"> 50%</span>;<span style="color: #ff0000;">
                margin-left</span>:<span style="color: #0000ff;"> -100px</span>;<span style="color: #ff0000;">
                margin-top</span>:<span style="color: #0000ff;"> -100px</span>;<span style="color: #ff0000;">
                border</span>:<span style="color: #0000ff;"> 1px solid black</span>;<span style="color: #ff0000;">
                border-radius</span>:<span style="color: #0000ff;"> 50%</span>;
            }<span style="color: #800000;">
            #list > li</span>{<span style="color: #ff0000;">
                position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;">
                list-style</span>:<span style="color: #0000ff;"> none</span>;<span style="color: #ff0000;">
                background</span>:<span style="color: #0000ff;"> black</span>;<span style="color: #ff0000;">
                left</span>:<span style="color: #0000ff;"> 99px</span>;<span style="color: #ff0000;">
                top</span>:<span style="color: #0000ff;"> 0px</span>;<span style="color: #ff0000;">
                width</span>:<span style="color: #0000ff;"> 2px</span>;<span style="color: #ff0000;">
                height</span>:<span style="color: #0000ff;"> 8px</span>;<span style="color: #ff0000;">
                transform-origin</span>:<span style="color: #0000ff;"> center 100px</span>;
                
            }<span style="color: #800000;">
            #list > li:nth-child(5n+1)</span>{<span style="color: #ff0000;">
                height</span>:<span style="color: #0000ff;"> 12px</span>;
            }<span style="color: #800000;">
            .licon</span>{<span style="color: #ff0000;">
                position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;">
                width</span>:<span style="color: #0000ff;"> 20px</span>;<span style="color: #ff0000;">
                height</span>:<span style="color: #0000ff;"> 20px</span>;<span style="color: #ff0000;">
                background</span>:<span style="color: #0000ff;"> pink</span>;<span style="color: #ff0000;">
                border-radius</span>:<span style="color: #0000ff;"> 50%</span>;<span style="color: #ff0000;">
                left</span>:<span style="color: #0000ff;"> 90px</span>;<span style="color: #ff0000;">
                top</span>:<span style="color: #0000ff;"> 90px</span>;
                
            }<span style="color: #800000;">
            .hour</span>{<span style="color: #ff0000;">
                width</span>:<span style="color: #0000ff;"> 6px</span>;<span style="color: #ff0000;">
                height</span>:<span style="color: #0000ff;"> 30px</span>;<span style="color: #ff0000;">
                background</span>:<span style="color: #0000ff;"> black</span>;<span style="color: #ff0000;">
                position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;">
                left</span>:<span style="color: #0000ff;">96px </span>;<span style="color: #ff0000;">
                top</span>:<span style="color: #0000ff;"> 70px</span>;<span style="color: #ff0000;">
                transform-origin</span>:<span style="color: #0000ff;"> center bottom</span>;
            }<span style="color: #800000;">
            .min</span>{<span style="color: #ff0000;">
                width</span>:<span style="color: #0000ff;"> 4px</span>;<span style="color: #ff0000;">
                height</span>:<span style="color: #0000ff;"> 50px</span>;<span style="color: #ff0000;">
                position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;">
                background</span>:<span style="color: #0000ff;"> black</span>;<span style="color: #ff0000;">
                left</span>:<span style="color: #0000ff;"> 98px</span>;<span style="color: #ff0000;">
                top</span>:<span style="color: #0000ff;"> 50px</span>;<span style="color: #ff0000;">
                transform-origin</span>:<span style="color: #0000ff;"> center bottom</span>;
            }<span style="color: #800000;">
            .sec</span>{<span style="color: #ff0000;">
                width</span>:<span style="color: #0000ff;"> 2px</span>;<span style="color: #ff0000;">
                height</span>:<span style="color: #0000ff;"> 70px</span>;<span style="color: #ff0000;">
                position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;">
                left</span>:<span style="color: #0000ff;"> 99px</span>;<span style="color: #ff0000;">
                top</span>:<span style="color: #0000ff;"> 30px</span>;<span style="color: #ff0000;">
                background</span>:<span style="color: #0000ff;"> red</span>;<span style="color: #ff0000;">
                transform-origin</span>:<span style="color: #0000ff;"> center bottom</span>;
            }<span style="color: #800000;">
            
            
        </style>
    
    
        <div id="wrap">
            <ul id="list">
                
            </ul>
            <div class="hour"/>
            <div class="min"/>
            <div class="sec"/>
            <div class="licon"/>
        </div>
    
    <script type="text/javascript" src="js/jquery-1.10.1.js"/>
    <script type="text/javascript">
        
        $(function()</span>{<span style="color: #ff0000;">
            
            var $listNode = $("#list");
            var $headNode = $("head>style");
            
            var hours = $(".hour");
            var mins = $(".min");
            var secs = $(".sec");
            var licons = $(".licon");
            
            
            for (var i =0 ; i < 60; i++){
                
                $listNode.append("<li></li>")
                $headNode.append("#list > li</span>:<span style="color: #0000ff;">nth-of-type("+(i+1)+"){transform: rotate("+(i*6)+"deg)</span>;}<span style="color: #800000;">")
            }
            //                    ,          ,      。
            move()
            setInterval(move,1000)
            
            function move()</span>{<span style="color: #ff0000;">
                console.log('aaa')
                var date = new Date()
                var sec = date.getSeconds()
                var min = date.getMinutes()+sec/60
                var hour = date.getHours()+min/60
                
                secs.css("transform","rotate("+(30*sec)+"deg)")
                mins.css("transform","rotate("+(6*min)+"deg)")
                hours.css("transform","rotate("+(30*hour)+"deg)")
                
            </span>}<span style="color: #800000;">
            
            
            
            
        })
        
    </script>
</span></code></pre> 
 </div> 
 <p> </p> 
</div>
                            </div>
                        </div>

좋은 웹페이지 즐겨찾기