zoukankan      html  css  js  c++  java
  • jquery最简单的右侧返回顶部代码(滚动才出现)

    <div style="display:none;" id="gotopbtn" class="to_top"><a title="返回顶部" href="javascript:void(0);"></a></div>
    <script type="text/javascript">
    $(function(){
    
        $(window).scroll(function(){
            $(window).scrollTop()>200 ? $("#gotopbtn").css('display','').click(function(){
                $(window).scrollTop(0);
            }):$("#gotopbtn").css('display','none');    
        });
        
    });
    </script>

     CSS代码

    .to_top a,.to_top a:hover{ background:url(../images/gotop1_03.gif) no-repeat;}
    .to_top a{
        background-position:0 0;float:left;height:83px;overflow:hidden;width:25px;position:fixed;bottom:35px;cursor:pointer;right:20px;
        _position:absolute;
        _right:auto;
        _left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft, 10)||0)-(parseInt(this.currentStyle.marginRight, 10)||20));
        _top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop, 10)||20)-(parseInt(this.currentStyle.marginBottom, 10)||20)));
    }
    .to_top span{ background:url(../images/gotop1_03.gif) no-repeat;}
    .to_top span{
        background-position:0 0;float:left;height:83px;overflow:hidden;width:25px;position:fixed;bottom:35px;cursor:pointer;right:20px;
        _position:absolute;
        _right:auto;
        _left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft, 10)||0)-(parseInt(this.currentStyle.marginRight, 10)||20));
        _top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop, 10)||20)-(parseInt(this.currentStyle.marginBottom, 10)||20)));
    }
  • 相关阅读:
    我的第一个java程序
    ==和equals的区别
    后缀数组题目总结
    后缀数组入门
    【POJ.3415 Common Substrings】后缀数组 长度不小于K的公共子串个数
    【UOJ #519 查查查乐乐】 DP
    【CF-1350 D. Orac and Medians】 思维
    【CF-1350 C
    【CF 1350 B.Orac and Models】 DP
    【POJ-2774】Long Long Message 后缀数组 最长公共子串(出现两次不重叠子串)
  • 原文地址:https://www.cnblogs.com/henshui/p/3300683.html
Copyright © 2011-2022 走看看