zoukankan      html  css  js  c++  java
  • 悬浮按钮

    作者QQ:1095737364    QQ群:123300273     欢迎加入!

     1.css样式 :

    <style>
    #topBtn {
        position: fixed;
        bottom: 380px;
        right: 50px;
        width: 60px;
        height: 60px;
        line-height: 60px;
        text-align: center;
        color: #FFF;
        z-index: 999;
        background: #FF5722;
        cursor: pointer;
        border-radius: 30px;
        box-shadow: 0px 0px 20px #000;
    }
    </style>

     2.js代码:

    <script type="text/javascript">
        $(function () {
            $("#topBtn").click(function () {
                $("html,body").animate({scrollTop: $("body").offset().top}, 600);
            });
        });
    </script>

     3.html 代码:

     <div id="topBtn">置顶</div>

     

  • 相关阅读:
    JAVA 动态代理
    IDEA 配置阿里云Maven
    JAVA Spring5静态代理
    Spring5 常用注解
    react
    Angular
    微信小程序
    H5
    vue-ui
    jQuery
  • 原文地址:https://www.cnblogs.com/yysbolg/p/7647200.html
Copyright © 2011-2022 走看看