Skip to content

Commit

Permalink
feat: 为文章顶部菜单的分享方式菜单添加展开和收回动画
Browse files Browse the repository at this point in the history
  • Loading branch information
HowieHz committed Dec 7, 2024
1 parent a3f59ec commit 8f3117b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
8 changes: 8 additions & 0 deletions src/assets/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,12 @@ $(document).ready(function () {
shareFooter.slideDown(200);
}
});
$("#actions #action-share").click(function () {
const shareMenu = $("#share-list");
if (shareMenu.is(":visible")) {
shareMenu.slideUp(200);
} else {
shareMenu.slideDown(200);
}
});
});
4 changes: 2 additions & 2 deletions src/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -617,14 +617,14 @@ body {
font-style: italic;
}

#header-post #share {
#header-post #share-list {
clear: both;
padding-top: 1rem;
padding-right: 2rem;
text-align: right;
}

#header-post #share li {
#header-post #share-list li {
display: block;
margin: 0;
}
Expand Down
2 changes: 1 addition & 1 deletion templates/assets/dist/main.iife.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion templates/assets/dist/style.css

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions templates/fragments/post-nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<li>
<a
class="icon"
href="#"
href="javascript:void(0);"
onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"
th:aria-label="#{fragment.post-nav.actions.to-top-icon.aria-label}"
>
Expand All @@ -80,11 +80,12 @@
<li>
<a class="icon" href="#" th:aria-label="#{fragment.post-nav.actions.share-icon.aria-label}">
<i
id="action-share"
class="iconify iconify-middle"
data-icon="mdi:share-variant-outline"
onmouseover="$('#i-share').toggle();"
onmouseout="$('#i-share').toggle();"
onclick="$('#share').toggle();return false;"
onclick="return false;"
></i>
</a>
</li>
Expand All @@ -98,7 +99,11 @@
<span id="i-home" class="info" style="display: none">[(#{fragment.post-nav.backToHome})]</span>
</span>
<br />
<div id="share" style="display: none" th:with="permalink=${post?.status?.permalink}, title=${post?.spec?.title}">
<div
id="share-list"
style="display: none"
th:with="permalink=${post?.status?.permalink}, title=${post?.spec?.title}"
>
<th:block th:insert="~{fragments/common :: share}"></th:block>
</div>
<div id="toc"></div>
Expand Down

0 comments on commit 8f3117b

Please sign in to comment.