zoukankan      html  css  js  c++  java
  • 快速回到顶部

    <!DOCTYPE html>

    <html lang="en">

     

    <head>

    <meta charset="utf-8">

    <title>Back to Top</title>

    <meta name="description" content="A simple page showing how to implement a back to top button">

    <meta name="author" content="Adi Purdila">

     

    <!-- Stylesheets -->

    <link rel="stylesheet" href="styles.css" />

     

    <!--[if lt IE 9]>

    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>

    <![endif]-->

    </head>

    <body>

     

    <div class="container">

    <hgroup>

    <h1>快速回到顶部按钮</h1>

    <h3>~</h3>

    </hgroup>

     

    <hr />

     

    <section>

    <p>  文本占位符,内容

    ==========邪恶的分隔线==========

    </p>

    <p>

    嘿嘿,你发现了,上面的是占位的,哈哈,

    </p>

    </section>

     

    <footer>

    <hr />

     

    <p>Just some basic footer text.</p>

     

    <a href="#" class="go-top">Go Top</a>

    </footer>

    </div> <!-- end container -->

     

    <!-- JavaScript -->

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

    <script>

    $(document).ready(function() {

    // Show or hide the sticky footer button

    $(window).scroll(function() {

    if ($(this).scrollTop() > 200) {

    $('.go-top').fadeIn(200);

    } else {

    $('.go-top').fadeOut(200);

    }

    });

     

    // Animate the scroll to top

    $('.go-top').click(function(event) {

    event.preventDefault();

     

    $('html, body').animate({scrollTop: 0}, 300);

    })

    });

    </script>

    </body>

    </html>

  • 相关阅读:
    【AtCoder】ARC097 (C
    【51nod】1123 X^A Mod B (任意模数的K次剩余)
    【洛谷】P4207 [NOI2005]月下柠檬树
    【POJ】2454.Jersey Politics
    【POJ】2069.Super Star
    【POJ】2420.A Star not a Tree?(模拟退火)
    【POJ】1026.Cipher
    【POJ】3270.Cow Sorting
    【POJ】1286.Necklace of Beads
    【POJ】1067.取石子游戏
  • 原文地址:https://www.cnblogs.com/nik2011/p/3057195.html
Copyright © 2011-2022 走看看