Skip to content

Commit

Permalink
feat: add back-to-top button (alshedivat#2427)
Browse files Browse the repository at this point in the history
slove alshedivat#2425

Demo:

<img width="1643" alt="image"
src="https://github.com/alshedivat/al-folio/assets/119845914/ea73b84b-1d09-4af8-b1ba-6090595f5ab7">

---------

Signed-off-by: simonwei97 <simonwei977@gmail.com>
Signed-off-by: Simonwei97 <119845914+simonwei97@users.noreply.github.com>
  • Loading branch information
simonwei97 authored and Karapost committed Jul 4, 2024
1 parent 94111f5 commit c5c4a55
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions _includes/scripts/back_to_top.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<script src="{{ '/assets/js/vanilla-back-to-top.min.js' | relative_url | bust_file_cache }}"></script>
<script>
addBackToTop();
</script>
1 change: 1 addition & 0 deletions _layouts/default.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@
{% include scripts/wechatModal.liquid %}
{% include scripts/imageLayouts.liquid %}
{% include scripts/jekyll_tabs.liquid %}
{% include scripts/back_to_top.liquid %}
</body>
</html>
8 changes: 8 additions & 0 deletions _sass/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@ $fa-font-path: "../webfonts";

// Tabler icons location
$ti-font-path: "../fonts";

// Back To Top button config
$back-to-top-z-index: 10;
$back-to-top-bottom: 50px;
$back-to-top-right: 50px;
$back-to-top-diameter: 56px;
$back-to-top-height: $back-to-top-diameter;
$back-to-top-width: $back-to-top-diameter;
1 change: 1 addition & 0 deletions assets/js/vanilla-back-to-top.min.js

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

0 comments on commit c5c4a55

Please sign in to comment.