zoukankan      html  css  js  c++  java
  • 兼容所有浏览器的图片旋转方案

    废话不多说,如图所示:直接上代码 :

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>图片旋转</title>
    <style type="text/css" >
    #div1{ position:relative;height:800px; border:1px solid red;}
    #div1 img{ position:absolute;}
    </style>
    </head>
    <body >
    <div id="div1"  >
     <img src="https://files.cnblogs.com/files/lguow/star.gif"  />
     <img src="https://files.cnblogs.com/files/lguow/star.gif"  />
     <img src="https://files.cnblogs.com/files/lguow/star.gif"  />
     <img src="https://files.cnblogs.com/files/lguow/star.gif"  />
     <img src="https://files.cnblogs.com/files/lguow/star.gif"  />
     <img src="https://files.cnblogs.com/files/lguow/star.gif"  />
    </div>
    <script type="text/javascript" >
      var centerx = 400; //圆心X
      var centery = 300; //圆心Y
      var r = 300; //半径
      var oimages = document.getElementById("div1").getElementsByTagName("IMG"); //图片集合
      var cnt = oimages.length; //图片数
      var da = 360 / cnt; //图片间隔角度
      var a0 = 0; //已旋转角度
      var timer;
      for (var i = 0; i < cnt; i++) {
        oimages[i].onmouseover = stop;
        oimages[i].onmouseout = start;
      }
      function posimgs() {
        for (var i = 0; i < cnt; i++) {
          oimages[i].style.left = centerx + r * Math.cos((da * i + a0) / 180 * Math.PI) + "px";
          oimages[i].style.top = centery + r * Math.sin((da * i + a0) / 180 * Math.PI) + "px";
        }
      }
      // posimgs();
      function start() {
        timer = window.setInterval("posimgs();a0++;", 100);
      }
      function stop() {
        window.clearInterval(timer);
      }
      start();
    </script>
    </body>
    </html>
  • 相关阅读:
    数据库的连接、会话与SQLite
    数据库的连接
    SQlite的结构——存储管理
    数据库 schema含义
    SQLite这么娇小可爱,不多了解点都不行啊
    简析打开数据库流程
    计算机系为什么要学数据库原理和设计?
    SQLite的sqlite3_prepare_v2
    Sqlite3并发读写注意事项
    SQLite也可能出现死锁
  • 原文地址:https://www.cnblogs.com/lguow/p/9448704.html
Copyright © 2011-2022 走看看