zoukankan      html  css  js  c++  java
  • 达到一定高度,回到头部的代码

    <script type="text/javascript">
    $(window).scroll(function(){$(this).scrollTop()>400?$(".gotop-btn").css("display","block"):$(".gotop-btn").hide()})
    </script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>返回顶部代码</title> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <style> @charset "utf-8"; html, body, h1, h2, h3, h4, h5, h6, hr, p, pre, blockquote, dl, dt, dd, ul, ol, li, form, fieldset, legend, input, textarea, button, img { margin:0; padding:0; } body, button, input, select, textarea { font:14px/1.8 "Microsoft Yahei", tahoma,arial,"Hiragino Sans GB", helvetica, sans-serif; } img { border:0;} .wraper { height:2000px; text-align:center; margin:0 auto; padding-top:20px; width:960px; background-color:#F7F7F7; font-size:22px; color:#FF0000; } .gotop { position:fixed; right:50%; bottom:20px; margin-right:-580px; } .gotop-btn { display:block; width:62px; height:52px; background:url(images/gotop.png) no-repeat 0 0; text-indent:-9999px; } .gotop-btn:hover { background-position:0 -54px; } </style> <script type="text/javascript" name="jquery" src="js/jquery-1.8.3.js"></script> </head>
    <body>
    <div class="wraper">鼠标往下滚动然后注意右下角,有惊喜!</div>
    <div class="gotop">
    <
    a href="javascript:document.body.scrollTop=0;document.documentElement.scrollTop=0;void(0);" class="gotop-btn" title="回到顶部" style="display:none; ">回到顶部</a>
    </
    div>

    <script type="text/javascript">
    $(window).scroll(function(){$(this).scrollTop()>400?$(".gotop-btn").css("display","block"):$(".gotop-btn").hide()})
    </script>
    </body> </html>

  • 相关阅读:
    supersockets扩展服务器配置
    SuperSocket根据条件获取 Session
    SuperSocket获取所有连接上的 Session
    淘宝天猫店铺微信公众平台建设指南
    微信浏览器内置JavaScript 对象:WeixinJSBridge
    微信公众平台开发(41)一键关注微信公众平台账号
    微信公众平台开发(39)支付宝手机网站支付
    如何重启一个控制台程序
    微信公众平台自定义菜单接口开发(1)
    Unicode编码解码在线转换工具
  • 原文地址:https://www.cnblogs.com/feika/p/4462725.html
Copyright © 2011-2022 走看看