Skip to content

Commit

Permalink
feat: post-nav-button 文章导航切换按钮
Browse files Browse the repository at this point in the history
buttons in post: next/prev article, home
  • Loading branch information
MOxFIVE committed Oct 17, 2015
1 parent e4e5226 commit 4aad43d
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
1 change: 1 addition & 0 deletions layout/_partial/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,4 @@
<a href="#footer" title="转到底部"><i class="fa fa-arrow-down"></i></a>
</div>
<% } %>
<%- partial('_partial/post-nav-button') %>
28 changes: 28 additions & 0 deletions layout/_partial/post-nav-button.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<% if (is_post()){ %>
<% if (post.prev && !post.next){ %>
<div class="post-nav-button">
<a href="<%- url_for(post.prev.path) %>" title="上一篇: <%= post.prev.title %>">
<i class="fa fa-angle-left"></i>
</a>
<a href="/" title="回到主页"><i class="fa fa-home"></i></a>
</div>
<% } %>
<% if (!post.prev && post.next){ %>
<div class="post-nav-button">
<a href="/" title="回到主页"><i class="fa fa-home"></i></a>
<a href="<%- url_for(post.next.path) %>" title="下一篇: <%= post.next.title %>">
<i class="fa fa-angle-right"></i>
</a>
</div>
<% } %>
<% if (post.prev && post.next){ %>
<div class="post-nav-button">
<a href="<%- url_for(post.prev.path) %>" title="上一篇: <%= post.prev.title %>">
<i class="fa fa-angle-left"></i>
</a>
<a href="<%- url_for(post.next.path) %>" title="下一篇: <%= post.next.title %>">
<i class="fa fa-angle-right"></i>
</a>
</div>
<% } %>
<% } %>
24 changes: 23 additions & 1 deletion source/css/_partial/main.styl
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,26 @@
color: #88acdb;
opacity: 1;
}
}
}
.post-nav-button {
position: fixed;
left: 300px;
top: 61.8%;
text-align: center;
a {
display: block;
width: 29px;
font-size: 28px;
}
.fa {
color: rgba(255, 255, 255, .8);
padding-top: 16px;
padding-bottom: 16px;
}
a:hover {
background: rgba(147, 181, 224, .3);
.fa {
color: white;
}
}
}
3 changes: 3 additions & 0 deletions source/css/_partial/mobile.styl
Original file line number Diff line number Diff line change
Expand Up @@ -308,4 +308,7 @@
color: none;
opacity: 1;
}
}
.post-nav-button {
display: none;
}

0 comments on commit 4aad43d

Please sign in to comment.