Permalink
Browse files

refactor: toTop button 简化返回顶部代码

Enable toTop button via <div id="toTop”> consistent with toBottom.
使用锚点<div id="toTop”>替换原来的JavaScript,更简洁统一。
  • Loading branch information...
MOxFIVE committed Aug 26, 2015
1 parent f353093 commit 121907e365dd4e14139dea6f96bed6f9d42ea46c
Showing with 7 additions and 6 deletions.
  1. +7 −6 themes/Yilia/layout/_partial/article.ejs
@@ -49,25 +49,26 @@
}
</script>
<div id="toTop"></div>
<script>
<div id="toTop">
<a href="#top" style="color:white"></a>
</div>
<!-- to top via JavaScript -->
<!--<script>
window.onload = function(){
var to_top = document.getElementById("toTop");
to_top.onclick = function(){
document.documentElement.scrollTop = document.body.scrollTop =0;
}
}
</script>
</script>-->
<div id="toBottom">
<a href="#footer" style="color:white"></a>
</div>
<!-- to bottom via JavaScript -->
<!--<div id="toBottom">
<a href="javascript:void(0);" onclick="javascript:document.getElementsByTagName('BODY')[0].scrollTop=document.getElementsByTagName('BODY')[0].scrollHeight;"></a>
</div> -->
<%- post.content %>
<% } %>

0 comments on commit 121907e

Please sign in to comment.