1、此博文图片样式引用腾讯网站,效果如下:

jquery返回页面顶部

2、样式设置:

#toTop {
       /*选中的背景图片的大小*/
    width: 54px;
    height: 54px;
    display: none;/*刚开始不显示*/
    position: fixed;
    right: 25px;/*距离右边大小值*/
    bottom: 45px;/*距离底部大小值*/
       /*选定图片区域*/
    background-image: url(images/qqbg_1.5.5.png);
    background-repeat: no-repeat;
    background-position: -700px -110px;
    opacity: 0.3; /*透明度*/
}

#toTop:hover {
    opacity: 1;/*悬停时不透明*/
    filter: alpha(opacity = 100);
}

3、JS代码:

<a href="#" target="_self" ></a>
<script type = "text/javascript">
    function toTopHide(){
        $(document).scrollTop()>400?
                $("#toTop").show()
                    :$("#toTop").hide();
    }
    $(window).scroll(function(){toTopHide()});
</script>

 

 推荐一个自己业余时间开发的网盘搜索引擎,360盘搜www.360panso.com

相关文章:

  • 2021-05-22
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2022-12-23
  • 2021-09-28
  • 2021-07-04
  • 2022-01-19
猜你喜欢
  • 2022-12-23
  • 2021-08-03
  • 2021-09-21
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2021-09-29
相关资源
相似解决方案