zoukankan      html  css  js  c++  java
  • 滚动页面旋转齿轮

         本例代码演示了滚动网页,齿轮转动的效果,增加网页动画效果。

        代码演示:查看演示

                                     

        css代码:

     html{color: #333;background-attachment: fixed;background-size: cover;background-repeat: no-repeat;border: solid #4ECDC4 20px;}
        body{margin: 2rem;font-family: Roboto Condensed, sans-serif;background: #f7fff7;margin: 200px 0 0 0;font-family: serif;line-height: 1.7;font-size: 100%;}
        h1{text-align: center;font-size: 1.7em;line-height:.8em;}
        p{display: block;-webkit-margin-before: 1em;-webkit-margin-after:1em;-webkit-margin-start: 0px;-webkit-margin-end: 0px;}
        nav{background-color: #4ECDC4;position: fixed;top: 0; 100%;height: 140px;}
        nav .logo{position: fixed;top: 20px;top: 20px;left: 50%;margin-left: -50px; 100px;height: auto;}
        main{max- 900px; 60%;margin: 0 auto;font-size: 2rem;}
    

      js代码:

      $(window).scroll(function () {
            var theta = $(window).scrollTop() / 600 % Math.PI;
            $('#logo').css({
                transform: 'rotate(' + theta + 'rad)'
            });
        });
    

      

  • 相关阅读:
    fiddler抓取java系程序的网络通信
    ZOJ 2724 Windows Message Queue(优先队列)
    FZU 电动车通行证制度
    Havel定理
    Catch That Cow
    Trie树
    zoj 2876 Phone List
    zoj 2420
    getchar
    zoj 1315 Excuses, Excuses!
  • 原文地址:https://www.cnblogs.com/hjlost/p/6122857.html
Copyright © 2011-2022 走看看