Skip to content

Commit

Permalink
refactor: scrolling button 页内跳转按钮优化
Browse files Browse the repository at this point in the history
Use a simpler way to hide comments button automatically.
优化隐藏评论按钮的逻辑,更简洁,适用性更好。
  • Loading branch information
MOxFIVE committed Dec 24, 2015
1 parent b676405 commit efacfb4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
13 changes: 0 additions & 13 deletions layout/_partial/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,6 @@
</section>
<% } %>

<% if (!index && post.comments){ %>
<style>
#scroll {
display: none;
}
</style>
<div class="scroll" id="scroll-with-comments">
<a href="#" title="返回顶部"><i class="fa fa-arrow-up"></i></a>
<a href="#comments" title="查看评论"><i class="fa fa-comments-o"></i></a>
<a href="#footer" title="转到底部"><i class="fa fa-arrow-down"></i></a>
</div>
<% } %>

<%- partial('_partial/post-nav-button') %>

<% if (post.fancybox != false){ %>
Expand Down
11 changes: 10 additions & 1 deletion layout/_partial/scrolling-button.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<div class="scroll" id="scroll">
<a href="#" title="返回顶部"><i class="fa fa-arrow-up"></i></a>
<a href="#comments" title="查看评论"><i class="fa fa-comments-o"></i></a>
<a href="#footer" title="转到底部"><i class="fa fa-arrow-down"></i></a>
</div>
</div>

<script>
$(document).ready(function() {
if ($("#comments").length < 1) {
$("#scroll > a:nth-child(2)").hide();
};
})
</script>
2 changes: 1 addition & 1 deletion source/css/_partial/main.styl
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@
};
}

#scroll, #scroll-with-comments {
#scroll{
right: 0;
}

Expand Down

0 comments on commit efacfb4

Please sign in to comment.