样式:

 <style type="text/css">
/*返回顶部特效*/
a
{
border: none;
text-decoration: none;
outline: none; /*移除虚线框 IE8,FF有用*/
hide-focus: expression(this.hideFocus=true); /*IE6、IE7*/
}
*html
{
background-image: url(about:blank);
background-attachment: fixed;
} /*低版本浏览器防止抖动的,必须有*/
#tbox
{
width: 65px;
height: 140px;
float: right;
position: fixed;
_position: absolute;
_bottom: auto;
_top: expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,)||)-(parseInt(this.currentStyle.marginBottom,)||)));
_margin-bottom: 50px;
}
/*这个只能改宽高其他的不要修改,需要滚动的内容都要放在这个div里面*/
#jiayi
{
display: block;
background: url({cssdir}/images/tj_QQ.png) no-repeat;
width: 65px;
height: 65px;
margin-bottom: 5px;
text-indent: -9999px;
overflow: hidden;
cursor: pointer;
} #gotop
{
display: block;
width: 65px;
height: 65px;
text-indent: -9999px;
overflow: hidden;
color: #fff;
background: url(/images/tj_fanhui.png) no-repeat;
position: absolute;
display: none;
cursor: pointer;
}
</style>

JavaScript:

 <script type="text/javascript">
jQuery(document).ready(function () {
//返回顶部方法
jQuery(window).scroll(function () {
t = jQuery(document).scrollTop();
if (t > ) {
jQuery('#gotop').fadeIn('slow');
} else {
jQuery('#gotop').fadeOut('slow');
}
})
a(, ); //#tbox的div距浏览器底部和页面内容区域右侧的距离
jQuery('#gotop').click(function () {
jQuery('body,html').animate({
scrollTop:
},
); //点击回到顶部按钮,缓懂回到顶部,数字越小越快
return false;
})
//end
});
//返回顶部方法
function a(x, y) {
l = jQuery('#main').offset().left;
w = jQuery('#main').width();
jQuery('#tbox').css('left', (w + x - ) + 'px');
jQuery('#tbox').css('bottom', y + 'px');
} //获取#tbox的div距浏览器底部和页面内容区域右侧的距离函数#main为页面的可视宽度
// target[0] = {endtime};
// time_id[time_id.length] = "TimeCounter_0"
</script>

Html:

  <div id="main">
</div>
<div id="tbox" style="z-index: 9999;">
<a href="http://wpa.qq.com/msgrd?v=3&uin=3118036766&Site=市政社区&Menu=yes" target="_blank"
id="jiayi">返回列表首页</a> <a id="gotop" href="javascript:void(0)" title="返回顶部">回到顶部</a>
</div>

Images:

JavaScript返回顶部特效的更多相关文章

  1. jquery返回顶部特效

    <style> p#back-to-top{position:fixed; bottom:100px;right:10px; display: none; } p#back-to-top ...

  2. javascript返回顶部几种代码总结

    纯js代码 /** * 回到页面顶部 * @param acceleration 加速度 * @param time 时间间隔 (毫秒) **/ function goTop(acceleration ...

  3. javascript返回顶部插件+源码

    javascript插件->returnTop.js: /* ** 插件名称returnTop.js ** 调用返回头部单例参数说明 ** 调用方式:turn.init(ele,speed); ...

  4. 写一个JavaScript“返回顶部”功能

    在web页面中,如果页面较高,为了方便用户快速地返回顶部,都会添加一个返回顶部按钮. 效果演示可以查看本页.如果页面有滚动高度,右下角就会有一个含有“返回顶部”字样的黑色背景半透明的小条条.点击这里“ ...

  5. WEB前端--返回顶部特效源码

    <!DOCTYPE html><html> <head> <meta charset="utf-8" /> <title> ...

  6. 【转】用jquery编写动态的返回顶部特效

    jquery代码: function gotoTop(min_height){ //预定义返回顶部的html代码,它的css样式默认为不显示 var gotoTop_html = '<div i ...

  7. Javascript返回顶部

    控制按钮下拉到达一定距离时显示,返回顶层时消失,用JS中的延时定时器来模拟滚动条效果 <script type="text/javascript"> window.on ...

  8. javascript 返回顶部

    <style> #linGoTopBtn {    POSITION: fixed; TEXT-ALIGN: center; LINE-HEIGHT: 30px; WIDTH: 30px; ...

  9. 原生js实现返回顶部特效

    index.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> &l ...

随机推荐

  1. 将几何画板x轴坐标值换成弧度制的方法

    大家在学习数学的过程中,都会遇到函数,这个时候大家都会遇到函数图像.对于函数图像我们一般都会通过先建立坐标系,然后让图像呈现在坐标系中.函数的种类有很多,三角函数就是其中之一,在绘制三角函数图像时,我 ...

  2. 添加RichEdit控件后导致MFC对话框程序无法运行的解决方法

    新建一个基于对话框的MFC程序,对话框上添加了RichEdit控件,编译成功后无法运行起来,Debug版本与Release版本均不行! Windbg分析结果: WARNING: Stack unwin ...

  3. 转载:resNet论文笔记

    <Deep Residual Learning for Image Recognition>是2016年 kaiming大神CVPR的最佳论文 原文:http://m.blog.csdn. ...

  4. Numpy常用金融计算(一)

    In [41]: a=[1,2,3,4,5,5,6,6,7,8,8,9,9] # list类型数组 In [42]: b=nu.mean(a) #调用numpy.mean方法计算数组元素的算术平均值 ...

  5. Amazon【EC2】如何启动一个新的EC2实例

    1.1 控制台可直接搜索ec2 1.2 创建实例 aws没有新建实例这个说法,新建就是启动实例 1.3 选择镜像 在搜索框中搜索自己想要的镜像.这里有收费的也有免费的 1.4 选择实例类型 选择自己想 ...

  6. 自己搭建v,p,n过程

    安装dockeryum install -y docker把docker设置为服务systemctl enable docker.service启动dockersystemctl start dock ...

  7. elasticsearch.net search入门使用指南中文版

    原文:http://edu.dmeiyang.com/book/nestusing.html elasticsearch.net为什么会有两个客户端? Elasticsearch.Net是一个非常底层 ...

  8. Castle 整合.NET Remoting

    今天研究了一下Castle的Remoting Facility.记录如下: 微软以前使用COM/DCOM的技术来处理分布式系统架构,通过Client端的Proxy代理程序来呼叫远程Server机器上的 ...

  9. spring中关于FeignClient的错误 QueryParam.value() was empty on parameter 1

    现创建一个feignClient的接口,在其他服务调用改client时发现服务启动失败错误日志如下: org.springframework.beans.factory.BeanCreationExc ...

  10. org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x160fd6f04410017 after 0ms

    dubbo报错: org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x160fd6f04410017 after ...