已恢复
用户体验不佳,已取消改功能
在<body></body>之间插入代码:
<div id=”shangxia”>
<div id=”shang”></div>
<div id=”comt”></div>
<div id=”xia”></div>
</div>
在网页中为对象建立位置
在<head></head>之间插入代码:
<?php if (is_single()) { ?>
<link rel=”stylesheet” href=”http://www.yourdomain/single_hd.css” type=”text/css” />
<?php } else { ?>
<link rel=”stylesheet” href=”http://www.yourdomain/other_hd.css” type=”text/css” />
<?php } ?>
跟据页面不同选择载入不同的样式表(有无评论)(建议加在<head></head>的最后,以免被前面覆盖)
在<head></head>之间插入代码:
<script type=”text/javascript” src=”http://www.yourdomain/shangxia.js”></script>
载入所需的js代码,wordpress一般已经载入jQuery(建议加在<head></head>的最后,以免不起作用)
上传shangxia.js文件,single_hd.css文件,other_hd.css文件,三个按钮文件(上,下,评论)
shangxia.js文件:
jQuery(document).ready(function($){var s= $(‘#shangxia’).offset().top;$(window).scroll(function (){$(“#shangxia”).animate({top : $(window).scrollTop() + s + “px” },{queue:false,duration:500});});$body = (window.opera) ? (document.compatMode == “CSS1Compat” ? $(‘html’) : $(‘body’)) : $(‘html,body’);$(‘#shang’).click(function(){$body.animate({scrollTop: ‘0px’}, 400);});$(‘#xia’).click(function(){$body.animate({scrollTop:$(‘#footer’).offset().top}, 800);});$(‘#comt’).click(function(){$body.animate({scrollTop:$(‘#comments’).offset().top}, 800);});});
single_hd.css文件:
@charset “utf-8”;/* CSS Document */
#shangxia{position:absolute; top:40%; left:50%; margin-left:-535px; display:block; }#shang{ background:url(https://www.yourdomain/shang.png) no-repeat; position:relative; cursor:pointer; height:42px; width:32px; margin:10px 0; }#comt{ background:url(https://www.yourdomain/comt.png) no-repeat center; position:relative; cursor:pointer; height:32px; width:32px; margin:10px 0; }#xia{ background:url(https://www.yourdomain/xia.png) no-repeat center; position:relative; cursor:pointer; height:42px; width:32px; margin:10px 0; }
other_hd.css文件:
@charset “utf-8”;/* CSS Document */
#shangxia{ position:absolute; top:40%; left:50%; margin-left:-535px; display:block; }#shang{ background:url(https://www.yourdomain/shang.png) no-repeat; position:relative; cursor:pointer; height:42px; width:32px; margin:10px 0; }#xia{ background:url(https://www.yourdomain/xia.png) no-repeat center; position:relative; cursor:pointer; height:42px; width:32px; margin:10px 0; }