zoukankan      html  css  js  c++  java
  • JQ返回顶部代码分享~~~~

    1.jq代码:

    <script type="text/javascript">
        $(function() {
            $("#tbox").click(scrollToTop);
        });
        function scrollToTop() {
            $("body,html").animate({
                scrollTop: 0
            }, 600);
            return false;
        }
    </script>
    <script type="text/javascript">
        function scrollToTop() {
            $("body,html").animate({
                scrollTop: 0
            }, 600);
            return false;
        }
    
        $(function() {
            // $("#tbox").hide();
            $(window).scroll(function() {
                if ($(this).scrollTop() > 100) {
                    $("#tbox").fadeIn();
                } else {
                    $("#tbox").fadeOut();
                }
            });
            $("#atop").click(scrollToTop);
        });
    </script>

    1.css代码:

    *{ padding:0px; margin:0px;}
    *html{background-image:url(about:blank);background-attachment:fixed;}/*解决IE6下滚动抖动的问题*/
    #tbox{float:right; position:fixed; right:2px; bottom:20px;
    _position:absolute;
    _bottom:auto;
    _top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));_margin-bottom:20px;}/*解决IE6下不兼容 position:fixed 的问题*/
  • 相关阅读:
    在图片上面添加字体
    wampserver php 识别不了>或者尖括号 php.ini中short_open_tag设置方法
    [P5162] WD与积木
    [P5170] 类欧几里得算法
    [P5172] Sum
    [HEOI2014] 大工程
    [P4721] 分治 FFT
    [BJOI2017] 树的难题
    [P4886] 快递员
    [CERC2014] Virus synthesis
  • 原文地址:https://www.cnblogs.com/ninali/p/3696048.html
Copyright © 2011-2022 走看看