Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1336,8 +1336,20 @@ textarea.input-field {
text-decoration: underline;
}

/*-----------------------------------*\
#BACK TO TOP BUTTON
\*-----------------------------------*/


#backToTopButton {
position: fixed;
bottom: 40px;
right: 40px;
padding: 10px 20px;
border-radius: 50%;
cursor: pointer;
display: none; /* Initially hidden */
}



Expand Down
29 changes: 28 additions & 1 deletion assets/js/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@



/*-----------------------------------*\
#BACK TO TOP BUTTON
\*-----------------------------------*/


const backToTopButton = document.getElementById("backToTopButton");

window.addEventListener("scroll", () => {
if (window.scrollY > 100) {
backToTopButton.style.display = "block";
} else {
backToTopButton.style.display = "none";
}
});

backToTopButton.addEventListener("click",
() => {
window.scrollTo({
top: 0,
behavior: "smooth"

});
});


/**
* PRELOAD
*
Expand Down Expand Up @@ -141,4 +168,4 @@ window.addEventListener("mousemove", function (event) {
parallaxItems[i].style.transform = `translate3d(${x}px, ${y}px, 0px)`;
}

});
});
8 changes: 8 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,15 @@ <h3 class="card-title title-2 text-center">
</div>
</footer>

<!--
- back to top button
-->

<button id="backToTopButton" class="btn btn-secondary" >
<span class="text text-1">^</span>

<span class="text text-2" aria-hidden="true">^</span>
</button>



Expand Down