样式:

 <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. 关于JSON日期格式显示及My97日期控件

    1.My97日期控件.显示不同的日期格式,可以调整"dateFmt“的参数来配置: 详细DEMO:http://www.my97.net/demo/index.htm <p>日期 ...

  2. iOS conformsToProtocol

    - (BOOL)conformsToProtocol:(Protocol *)aProtocol; 是用来检查对象(包括其祖先)是否实现了指定协议类的方法. 今天遇到一个问题,一个类没有实现proto ...

  3. C++ 检查Windows服务运行状态

    检查Windows服务运行状态  C++ Code  1234567891011121314151617181920212223242526272829303132333435363738394041 ...

  4. java.lang.NoSuchMethodException: &lt;init&gt; [class android.content.Context, interface androidutil.Attri

    <pre name="code" class="java"><span style="font-size:24px;"&g ...

  5. Integer自动装拆箱

    public static void main(String[] args) { Integer a1 = 1; Integer a2 = 1; Integer b1 = 127; Integer b ...

  6. boost::interprocess(1)

    发送端:#include <iostream> #include <windows.h> #include <string> using namespace std ...

  7. Android UI开发第三十九篇——Tab界面实现汇总及比较

    Tab布局是iOS的经典布局,Android应用中也有大量应用,前面也写过Android中TAb的实现,<Android UI开发第十八篇——ActivityGroup实现tab功能>.这 ...

  8. wordpress添加关键字

    wordpress自动添加标签为关键字: <?php //判断是否为首页 if ( is_home ()) { $description = "jcomey一个文艺青年的个人博客&qu ...

  9. spring + quartz 定时

    springConfig配置文件: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=& ...

  10. Oracle是如何工作的?实例是如何响应用户请求?一条SQL的执行过程~

    Oracle 是如何工作的? Select id,name from t order by id ; – SQL 解析(查看语法是否错误,如果没有错误,分析语意,执行此语句的权限) – 执行计划(OR ...