Skip to content

Commit 9e59ab8

Browse files
authored
Fix: Add back-to-top button (#2433)
Fixes #2425 PR #2427 adds a back-to-top button, however the button overlaps with the footer when `footer_fixed: false` and [has inadequate spacing](#2425 (comment)) with `footer_fixed: true` Changes in this PR: - Fix positioning of button on fixed and sticky footer layouts - Add option to disable back-to-top button by setting `back_to_top: false` in `_config.yml` - Add button transparency to avoid button blocking content view - Reduce size of button Demo - | Device | Fixed footer | Sticky footer | | :-----------: | :-------------: | :-----------: | | Mobile | ![fixed_footer_mobile](https://github.com/alshedivat/al-folio/assets/2447878/2e17be04-1fa7-40c5-b691-829e92055367) | ![sticky_footer_mobile](https://github.com/alshedivat/al-folio/assets/2447878/f5567e43-e6fe-442d-9a7f-99e0577e220b) | | Desktop | ![fixed_footer_desktop](https://github.com/alshedivat/al-folio/assets/2447878/fc755839-841a-4e6b-b249-2c75bc552ad8) | ![sticky_footer_desktop](https://github.com/alshedivat/al-folio/assets/2447878/ef9a4c99-ce4c-4ac3-8fbb-207af9be245a) | Miscellaneous change - Added personal website under `Academics` to `README.md`
1 parent 92cebc9 commit 9e59ab8

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ Feel free to add your own page(s) by sending a PR.
138138
<a href="https://chrischoi314.github.io" target="_blank">★</a>
139139
<a href="https://riccobelli.faculty.polimi.it" target="_blank">★</a>
140140
<a href="https://kishanved.tech/" target="_blank">★</a>
141+
<a href="https://abhilesh.github.io/" target="_blank">★</a>
141142
</td>
142143
</tr>
143144
<tr>

_config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ url: https://alshedivat.github.io # the base hostname & protocol for your site
2121
baseurl: /al-folio # the subpath of your site, e.g. /blog/. Leave blank for root
2222
last_updated: false # set to true if you want to display last updated in the footer
2323
impressum_path: # set to path to include impressum link in the footer, use the same path as permalink in a page, helps to conform with EU GDPR
24+
back_to_top: true # set to false to disable the back to top button
2425

2526
# -----------------------------------------------------------------------------
2627
# Theme

_includes/scripts/back_to_top.liquid

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<script src="{{ '/assets/js/vanilla-back-to-top.min.js' | relative_url | bust_file_cache }}"></script>
22
<script>
3-
addBackToTop();
3+
{% if site.back_to_top %}
4+
addBackToTop();
5+
{% endif %}
46
</script>

_sass/_themes.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
--global-divider-color: rgba(0, 0, 0, 0.1);
1818
--global-card-bg-color: #{$white-color};
1919
--global-highlight-color: #{$red-color-dark};
20-
--global-back-to-top-bg-color: #{$black-color};
20+
--global-back-to-top-bg-color: rgba(#{red($black-color)}, #{green($black-color)}, #{blue($black-color)}, 0.4);
2121
--global-back-to-top-text-color: #{$white-color};
2222

2323
--global-tip-block: #42b983;
@@ -79,7 +79,7 @@ html[data-theme="dark"] {
7979
--global-distill-app-color: #{$grey-color-light};
8080
--global-divider-color: #424246;
8181
--global-card-bg-color: #{$grey-900};
82-
--global-back-to-top-bg-color: #{$white-color};
82+
--global-back-to-top-bg-color: rgba(#{red($white-color)}, #{green($white-color)}, #{blue($white-color)}, 0.5);
8383
--global-back-to-top-text-color: #{$black-color};
8484

8585
--global-tip-block: #42b983;

_sass/_variables.scss

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ $ti-font-path: "../fonts";
4343

4444
// Back To Top button config
4545
$back-to-top-z-index: 10;
46-
$back-to-top-bottom: 50px;
47-
$back-to-top-right: 50px;
48-
$back-to-top-diameter: 56px;
46+
$back-to-top-bottom: 30px;
47+
$back-to-top-right: 30px;
48+
$back-to-top-diameter: 40px;
4949
$back-to-top-height: $back-to-top-diameter;
5050
$back-to-top-width: $back-to-top-diameter;

assets/js/vanilla-back-to-top.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)