Skip to content

Commit

Permalink
Merge pull request #166 from jiangjiang1116/dev
Browse files Browse the repository at this point in the history
feature: 新增圆形头像和圆形头像旋转选项
  • Loading branch information
HiNinoJay authored Nov 28, 2024
2 parents fbc3678 + 064773e commit e963224
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
4 changes: 3 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ post:
titlePosition: center # left | center 文章标题的位置

# 相对于source目录下的头像url
favicon: /img/favicon.webp
favicon: /img/favicon.webp # 默认方形头像
isRoundedAvatar: false # 是否圆形头像
isAvatarRotating: false # 圆形头像是否开启悬浮旋转

# 是否启用一些特色工具 false | true
tool:
Expand Down
32 changes: 28 additions & 4 deletions layout/_partial/post-header.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,38 @@

<div class="header">
<div class="header-container">
<img style="
width: 56px;
height: auto;" alt="^-^" cache-control="max-age=86400" class="header-img" src="<%- url_for(theme.favicon) %>" width="10%"></img>
<style>
.header-img {
width: 56px;
height: auto;
object-fit: cover; /* 保持图片比例 */
transition: transform 0.3s ease-in-out;
border-radius: <%= theme.isRoundedAvatar ? '50%' : '0' %>;
}
<% if (theme.isAvatarRotating && theme.isRoundedAvatar) { %>
.header-img:hover {
animation: rotateAnimation 2s linear infinite; /* 悬停旋转动画 */
}
@keyframes rotateAnimation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
<% } %>
</style>
<img
alt="^-^"
cache-control="max-age=86400"
class="header-img"
src="<%- url_for(theme.favicon) %>"
/>
<div class="header-content">
<a class="logo" href="<%- url_for() %>"><%= config.title %></a>
<span class="description"><%= config.description %></span>
</div>

</div>


Expand Down

0 comments on commit e963224

Please sign in to comment.