Skip to content

Commit 8747810

Browse files
committed
Correcting error in footer that was overlapping the page
1 parent 80a2aeb commit 8747810

File tree

3 files changed

+46
-43
lines changed

3 files changed

+46
-43
lines changed

_includes/layout/footer.html

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,14 @@
66

77
{%- include layout/data.liquid -%}
88

9-
<footer class="fixed-bottom footer">
109

11-
<!-- line top button -->
12-
{%- if footer_.top_button.enable -%}
13-
<div class="row top">
14-
<div class="col-md d-flex justify-content-end">
15-
<a id="top-link" class="top-link" href="#top">{{ footer_.top_button.icon }}</a>
16-
</div>
17-
</div>
18-
{%- endif -%}
19-
<!-- line top button -->
10+
{%- if footer_.top_button.enable -%}
11+
<a id="top-link" href="#top" class="top-link" aria-label="back to top">
12+
{{ footer_.top_button.icon }}
13+
</a>
14+
{%- endif -%}
15+
16+
<footer class="fixed-bottom footer">
2017

2118
<!-- line footer content -->
2219
<div class="row footer-wrapper">

_sass/includes/_footer.scss

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,37 @@
1+
.top-link {
2+
position: fixed;
3+
color: var(--primary-color);
4+
text-decoration: none !important;
5+
bottom: var(--margin-bottom);
6+
right: 1.2rem;
7+
width: 45px;
8+
height: 45px;
9+
display: none;
10+
align-items: center;
11+
justify-content: center;
12+
font-size: 3.5rem;
13+
line-height: 1;
14+
z-index: 1050; /* acima do conteúdo, abaixo de modals bootstrap */
15+
pointer-events: auto; /* permite clique apenas nele */
16+
transition: opacity .3s ease, transform .3s ease;
17+
opacity: 0;
18+
&:hover {
19+
color: var(--text-color);
20+
}
21+
}
22+
23+
.top-link.show {
24+
display: flex;
25+
opacity: 1;
26+
transform: translateY(0);
27+
}
28+
129
.footer {
230
font: 16.34px monospace !important;
331
font-size: .75rem !important;
432
letter-spacing: normal !important;
533
color: var(--text-color);
6-
padding: 0px 10px;
34+
padding: 0px 15px;
735

836
&-wrapper {
937
height: 24px;
@@ -12,23 +40,6 @@
1240
background-color: var(--footer-bg-color);
1341
}
1442

15-
.top {
16-
background-color: transparent;
17-
margin-bottom: 5px;
18-
margin-right: 2px;
19-
20-
@media (max-width: 1040px) {
21-
display: none;
22-
}
23-
24-
&-link {
25-
font-size: 3rem;
26-
display: none;
27-
text-decoration: none !important;
28-
z-index: 99;
29-
}
30-
}
31-
3243
&-copyright-wrap {
3344
text-align: left;
3445

assets/js/fallback/default.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,21 @@ document.addEventListener("DOMContentLoaded", () => {
5757
/* Show/disappear top button
5858
--------------------------------------------------------------------------------------------------
5959
*/
60-
let topButton = document.getElementById("top-link");
60+
const topButton = document.getElementById("top-link");
6161
const scrollThreshold = 700;
62-
window.onscroll = function () { scrollFunction() };
6362

64-
function scrollFunction() {
65-
if (document.body.scrollTop > scrollThreshold || document.documentElement.scrollTop > scrollThreshold) {
66-
topButton.style.display = "block";
63+
window.addEventListener("scroll", () => {
64+
if (window.scrollY > scrollThreshold) {
65+
topButton.classList.add("show");
6766
} else {
68-
topButton.style.display = "none";
67+
topButton.classList.remove("show");
6968
}
70-
}
71-
72-
topButton.addEventListener("click", topFunction);
69+
});
7370

74-
function topFunction() {
75-
window.scrollTo({
76-
top: 0,
77-
behavior: 'smooth'
78-
});
79-
}
71+
topButton.addEventListener("click", (e) => {
72+
e.preventDefault();
73+
window.scrollTo({ top: 0, behavior: "smooth" });
74+
});
8075

8176
/* function Giscus
8277
--------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)