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" xml:lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>Document</title>
    <style type="text/css">
    #demo{
    512px;
    height: 400px;
    border: 1px solid red;
    overflow: hidden;
    margin: 100px auto;
    position: relative;
    }
    #up{
    512px;
    height: 200px;
    position: absolute;
    top: 0;
    cursor: pointer;
    }
    #down{
    512px;
    height: 200px;
    position: absolute;
    bottom: 0;
    cursor: pointer;
    }
    #pic{
    position: absolute;
    top: 0;
    }

    </style>
    <script type="text/javascript">
    window.onload=function(){
    function $(id){ return document.getElementById(id)}
    var num = 0;
    var timer = null;// 定时器名称
    //鼠标经过上面框时,图片向上走
    $("up").onmouseover = function(){
    clearInterval(timer);
    timer = setInterval(function(){
    num -= 3;
    //如果num大于等于-1070,图片继续一直向上走.
    num >= -1070 ? $("pic").style.top = num +"px" : clearInterval(timer);
    },30)
    }
    //鼠标经过下面框时,图片向下走
    $("down").onmouseover = function(){
    clearInterval(timer);
    timer = setInterval(function(){
    num ++;
    num < 0 ? $("pic").style.top = num +"px" : clearInterval(timer);

    },40)
    }
    }
    </script>
    </head>

    <body>
    <div id="demo">
    <img src="images/mi.png" id="pic">
    <span id="up"></span>
    <span id="down"></span>
    </div>

    </body>
    </html>

  • 相关阅读:
    tree
    单向链表反转
    libev使用方法
    PowerManagerService流程分析
    Android source code compile error: “Try increasing heap size with java option '-Xmx<size>'”
    解决git合并冲突问题
    python之字典
    Django----admin管理工具
    流程控制,以及字符串
    python入门
  • 原文地址:https://www.cnblogs.com/zhaocong/p/6962431.html
Copyright © 2011-2022 走看看