zoukankan      html  css  js  c++  java
  • <jQuery> <方法> 十五. scrollTop()方法和scrollLeft()方法

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <style>
            body {
                width: 2000px;
                height: 2000px;
            }
        </style>
    </head>
    <body>
    
    
    <div></div>
    <input type="button" value="顶部">
    <input type="button" value="左边">
    <script src="jquery-3.2.1.js"></script>
    <script>
        $(function () {
            $(window).scroll(function () {
                // 距离上边的距离
                console.log($(window).scrollTop());
    
                // 距离左边的距离
                console.log($(window).scrollLeft());
            });
        });
    </script>
    </body>
    </html>
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <style>
            body {
                width: 2000px;
                height: 2000px;
            }
        </style>
    </head>
    <body>
    
    
    <div></div>
    <input type="button" value="顶部">
    <input type="button" value="左边">
    <script src="jquery-3.2.1.js"></script>
    <script>
        $(function () {
            $(window).scroll(function () {
                // 距离上边的距离
                console.log($(window).scrollTop());
    
                // 距离左边的距离
                console.log($(window).scrollLeft());
            });
        });
    </script>
    </body>
    </html>
  • 相关阅读:
    hadoop2.2.0伪分布式搭建
    HBase详解
    Hbase常用命令
    hbase读取数据原理
    约瑟夫环
    哈希表设计
    哈夫曼树的建立
    TCP的连接和释放
    什么是Kmp算法?
    什么是https
  • 原文地址:https://www.cnblogs.com/ZeroHour/p/8276583.html
Copyright © 2011-2022 走看看