Jquery 回到顶部
转:http://www.cnblogs.com/DemoLee/archive/2012/04/20/2459082.html
先来看几个图片效果:






提供几个样式图片:







样式图片都可以自己随便修改了
样式css:

<style type="text/css">
body,p,a,div{
margin:0px;
padding:0px;
}
body{
font:14px/22px Georgia serif;
margin:0 auto;
width:640px;
}
h1{
font: bold 80%/120% Arial, Helvetica, sans-serif;
text-transform: uppercase;
margin: 0 0 10px;
color: #999;
}
h2{
font-size: 22px;
margin: 0 0 8px;
}
h3{
font-size: 1.6em;
margin: 20px 0 5px;
}
a{
color: #333;
text-decoration: none;
}
a:hover{
color: #548B02;
}
p{
margin-bottom:25px;
}
#back-to-top{
position:fixed;
bottom:100px;
left:60px;
}
#back-to-top a{
text-align:center;
text-decoration:none;
color:#d1d1d1;
display:block;
width:80px;
/*使用CSS3中的transition属性给跳转链接中的文字添加渐变效果*/
-moz-transition:color 1s;
-webkit-transition:color 1s;
-o-transition:color 1s;
}
#back-to-top a:hover{
color:#979797;
}
#back-to-top a span{
background:#d1d1d1;
border-radius:6px;
display:block;
height:80px;
width:80px;
background:#d1d1d1 url(images/arrow_up1.png) no-repeat center center;
/*这是图片链接地址1*/ margin-bottom:5px;
-moz-transition:background 1s;
-webkit-transition:background 1s;
-o-transition:background 1s;
}
#back-to-top a:hover span{
background:#979797 url(images/arrow_up1.png) no-repeat center center;
/*这是图片链接地址1*/ }
</style>

Jquery代码:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>//这里引入你自己的jq或者用这个在线jq <script type="text/javascript">
$(document).ready(function () {
//首先将#back-to-top隐藏
$("#back-to-top").hide();
//当滚动条的位置处于距顶部100像素以下时,跳转链接出现,否则消失
$(function () {
$(window).scroll(function () {
if ($(window).scrollTop() > 100) {
$("#back-to-top").fadeIn(1500);
}
else {
$("#back-to-top").fadeOut(1000);
}
});
//当点击跳转链接后,回到页面顶部位置
$("#back-to-top").click(function () {
$('body,html').animate({ scrollTop: 0 }, 1000);
return false;
});
});
}); </script>

html:
<body id="top">
<p id="back-to-top"><a href="#top"><span></span>回到顶部</a></p>
这里面放文章的内容就好了 </body>
文章内容自己添加
|
|||||||||
| 日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
|---|---|---|---|---|---|---|---|---|---|
| 25 | 26 | 27 | 28 | 29 | 30 | 31 | |||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | |||
| 8 | 9 | 10 | 11 | 12 | 13 | 14 | |||
| 15 | 16 | 17 | 18 | 19 | 20 | 21 | |||
| 22 | 23 | 24 | 25 | 26 | 27 | 28 | |||
| 29 | 30 | 1 | 2 | 3 | 4 | 5 | |||
搜索
最新随笔
随笔分类(44)
随笔档案(43)
积分与排名
- 积分 - 12483
- 排名 - 10740
最新评论
- 1. Re:Easyui1.32源码翻译--datagrid(数据表格)
- 顶博主,美周郎, 金链男子白玉床. 战罢娇娘三百万, 江湖人称不倒枪, 银镯女优常留寝, 夸你活好耐力强.
- --斯诺登
- 2. Re:Easyui1.32源码翻译--datagrid(数据表格)
- 赞
- --要有好的心情
- 3. Re:Easyui1.32源码翻译--datagrid(数据表格)
- 武腾兰、吉泽明步、苍井空、松岛枫、神谷姬、小泽玛莉亚、高树玛丽亚、山本梓、樱树露衣、濑户由衣、树麻里子、星野光、白石瞳、忧木瞳、白石日和、相田桃、浅仓舞、小林瞳、夕树舞子、美穗由纪、小室友里、黑木香、朝冈实岭、美里真里、饭岛爱、北原梨奈、秋元友美、川合里美、细川百合子、麻生早苗、松阪季实子、川岛和津实、小泽奈美、叶山丽子、金泽文子、凉木桃香、小泽圆、铃木麻奈美、白鸟智香子、中谷香子、市川香织、蜷川...
- --Jimmy-Lee
- 4. Re:JavaScript数据类型之Boolean类型
- C 也是这种机制呐
- --FX夜归人
阅读排行榜
评论排行榜
Jquery 回到顶部的更多相关文章
- jQuery回到顶部
jquery回到顶部 <!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset=& ...
- jQuery回到顶部插件jQuery GoUp
插件描写叙述 jQuery GoUp!是一个简单的jQuery插件,让你的网页用户直接回到顶部. 用法很easy 引用jquery库和jquery.goup.min.js到你的页面 <scrip ...
- html css jquery 回到顶部按钮
今天做了个回到顶部的功能,在这里记录一下,有需要可以拿去试试! CSS部分,很简单就一个class /*回到顶部*/ .back-top { position: fixed; right: 15px; ...
- Jquery回到顶部插件【query.scrollUp.js】使用
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta na ...
- jquery 回到 顶部
1. 页面内容较多, 从底部超链接 点击回到页面顶部 // 回到顶部 var $top = $('<a class="doc-gotop" href="javasc ...
- Jquery回到顶部功能
问题描述: 在网页中,我们经常会由于网页内容过长,而需要在浏览网页时有一个快速回到网页顶部的功能,在浏览网页内容离顶部有一段距离时,出现快速回到网页顶部的工具,从而能使我们的网页更人性化. 问题的产生 ...
- jquery 回到顶部,简洁大方
效果
- JQuery 回到顶部效果
图片,CSS/HTML/JS代码都在,可以直接用了. CSS代码 <style type="text/css"> #gs_feedback_gotop { _displ ...
- Jquery回到顶部效果
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> &l ...
随机推荐
- 动画 -- ListView列表item逐个出来(从无到有)
import android.app.ListActivity; import android.os.Bundle; import android.widget.ArrayAdapter; publi ...
- 【LeetCode 213】House Robber II
This is an extension of House Robber. After robbing those houses on that street, the thief has found ...
- 详解Asp.net MVC DropDownLists
Asp.net MVC中的DropDownLists貌似会让一开始从Asp.net Forms转过来的程序员造成不少迷惑.这篇文章讲述了为了使用DropDownLists,你需要在Asp.Net MV ...
- OpenGL超级宝典第5版&&GLSL法线变换
在GLSL中,有一些情况需要把局部坐标系下的向量或点转换到视点坐标系下,如光照计算时,需要把法向转化到视点坐标系.如果是模型上一点p 转化到视点坐标系下,直接(model-view matrix )* ...
- redis集群的搭建
1.首先下载好软件包 #cd /opt/tzr/ #wget http://redis.googlecode.com/files/redis-2.6.11.tar.gz #mkdir /opt/tzr ...
- 链表回文串判断&&链式A+B
有段时间没有练习了,链表回文串判断用到了栈.链式A+B将没有的项用0补充.链表有没有头节点,及结点和链表的区别,即pNode和pHead. //#include<iostream> //u ...
- java BigInteger类的用法
import java.math.BigInteger; Scanner in = new Scanner(System.in); BigInteger x1 = new BigInteger(&qu ...
- Selection sort
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...
- erlang局域网内节点通信——艰难四步曲 (转)
http://blog.chinaunix.net/uid-22566367-id-382011.html 在Programming Erlang这本书中,在写到第十章中,主要实现的是不同节点之间的通 ...
- RabbitMQ (二)工作队列 -摘自网络
这篇中我们将会创建一个工作队列用来在工作者(consumer)间分发耗时任务.工作队列的主要任务是:避免立刻执行资源密集型任务,然后必须等待其完成.相反地,我们进行任务调度:我们把任务封装为消息发送给 ...





