• 实现“类似电梯”回到网页指定位置


    <!DOCTYPE html>
    <html>
    <head lang="zh">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta charset="utf-8" /> 
        <meta content="yes" name="apple-mobile-web-app-capable"/>
        <meta content="yes" name="apple-touch-fullscreen"/>
        <meta content="telephone=no" name="format-detection"/>
        <meta content="black" name="apple-mobile-web-app-status-bar-style">
        <meta content="#ffffff" name="msapplication-TileColor" />
        <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
        <title>采销商品基本信息</title>
        <link rel="stylesheet" href="css/index.css"/>
        
    
    </head> 
    <body>
    
    <div class="pox">
        佛得角粉丝卡<span>jkladja</span>放到那送到哪
    </div>
    
    <div class="pox-1">
        佛得角粉丝卡<span>jkladja</span>放到那送到哪<input type="text" name="" value="hello">
    </div>
    <p>1</p><p>1</p><p class="button1">1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p>
            <p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p>
            <p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p class="button2">2</p>
            <p>1</p><p class="button3">3</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p>
            <p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p>
            <p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p>
            <p>1</p><p>1</p><p class="button4">4</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p>
            <p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p>
            <div class="my-button">
                <ul>
                    <li name="button1">按钮1</li>
                    <li name="button2">按钮2</li>
                    <li name="button3">按钮3</li>
                    <li name="button4">按钮4</li>
                </ul>
            </div>
    
    
    
    <script type="text/javascript" src="./js/jquery.js"></script>
    <script type="text/javascript">
    
    jQuery.fn.scrollTop=function(speed){
        var targetOffset=$(this).offset().top;
        console.log(targetOffset);
        $("html,body").stop().animate({scrollTop:targetOffset},speed);
        return this;
    }
        $(".my-button ul li").click(function(){
            var thisname='.'+$(this).attr("name");//构建class的名字eg:.name;
            $(thisname).scrollTop(500);
            return false;
        });
    
    
    
    </script>
      
    </body> 
    </html>

     点击按钮1234分别对应的回到button1/button2/button3/button4的位置!

  • 相关阅读:
    用Shell判断字符串包含关系
    shell命令调用http接口(curl方式)
    shell脚本实现发送信息到钉钉
    功能测试特殊字符处理总结
    Java_Swing实现小球沿正弦曲线运动的代码
    Python迁移MySQL数据到MongoDB脚本
    1. WP8.1学习笔记
    0. WP8.1学习笔记
    小练习--低仿系统计算器
    C#字符串题目
  • 原文地址:https://www.cnblogs.com/xiaozhumaopao/p/5810378.html
Copyright © 2020-2023  润新知