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>

  • 相关阅读:
    ncnn 编译配置
    Android 配置 ncnn
    Android Studio 配置 OpenCV4+
    ROS catkin cheat sheet
    CMake 使用代理服务器
    Git设置代理服务器
    安卓assets处理
    【Android】Toast on non-UI thread
    高级语言编译和运行系统
    linux环境安装包方式
  • 原文地址:https://www.cnblogs.com/zhaocong/p/6962431.html
Copyright © 2011-2022 走看看