Emlog返回顶部和底部的自定义代码

Emlog返回顶部和底部的自定义代码

源码模板元火工作室2013-04-13 13:14:4012852A+A-

1. 把下列代码放到对应的模版下的main.css中 #goto{position:absolute;top:610px;left:1030px} #goto #top, #goto #bottom{width:28px;height:41px;margin:5px 0!important;background:url('images/goto.gif') no-repeat;display:block;text-indent:-9999px;cursor:pointer} #goto #top {background-position: 0 0} #goto #bottom {background-position: 0 100%}

 

2.修改footer.php的信息
<div id="goto"><div id="top">顶部</div><div id="bottom">底部</div></div>
<script type="text/javascript" src="<?php echo BLOG_URL; ?>include/lib/js/jquery/jquery-1.7.1.js"></script>
<script type="text/javascript">
jQuery(function($){
$('#top').click(function(){
$('html,body').animate({scrollTop: '0px'}, 800);
return false;
});
$('#bottom').click(function(){
$('html,body').animate({scrollTop:$('#footerbar').offset().top}, 800);
return false;
});
$(window).scroll(function() {
$("#goto").animate({top: ($(window).scrollTop() + 200) + "px"},{queue: false,duration: 1000})
});
});
</script>
3. 注意红字部分换成你自己的图片和地址即可。然后大功告成,可参考本站的效果。
0
0
打赏
0
点击这里复制本文地址

支持Ctrl+Enter提交
qrcode

蒙文软件|蒙古软件|蒙古软件下载|蒙文手机|蒙古网站|蒙科立||Mongolian Software|Mongolian Software Download|Mongolian Phone|Mongolia Website|Mongolia| © All Rights Reserved.  蒙ICP备13001995号-4蒙公网安备15052402000125号
Powered by Z-BlogPHP Themes by 蒙古文软件大全
联系我们| 关于网站| 免责声明