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
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ <h2>Projects</h2>
</div> <!-- /preview-section -->
</div> <!-- /main-container -->



<!-- Back to Top Button -->
<button id="backToTopBtn" title="Go to top">↑</button>


<footer style="margin-top: 2rem; padding: 1rem 0; text-align: center; font-size: 0.9rem;" class="footer">
<div class="foot">
<p class="footer-text">&copy; 2025. All rights reserved.</p>
Expand Down
23 changes: 23 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,28 @@ function clearAndReload() {
window.location.reload();
}

//back to top button
// Back to Top Button Functionality
document.addEventListener("DOMContentLoaded", function () {
const backToTopBtn = document.createElement("button");
backToTopBtn.id = "backToTopBtn";
backToTopBtn.title = "Go to top";
backToTopBtn.textContent = "↑";
document.body.appendChild(backToTopBtn);

window.addEventListener("scroll", function () {
if (window.scrollY > 50) {
backToTopBtn.classList.add("show");
} else {
backToTopBtn.classList.remove("show");
}
});

backToTopBtn.addEventListener("click", function () {
window.scrollTo({ top: 0, behavior: "smooth" });
});
});

async function improveText(textareaId) {
const textarea = document.getElementById(textareaId);
const suggestionBox = document.getElementById(`suggestion-${textareaId}`);
Expand Down Expand Up @@ -574,3 +596,4 @@ async function improveText(textareaId) {
}
}


29 changes: 29 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -404,3 +404,32 @@ body.dark .footer-link {
.section {
transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Back to Top Button */
/* Back to Top Button */

#backToTopBtn {
display: none;
position: fixed;
bottom: 40px;
right: 40px;
z-index: 999;
font-size: 20px;
background-color: #3b82f6;
color: #f7f9fc;
border: none;
outline: none;
padding: 12px 16px;
border-radius: 50%;
cursor: pointer;
box-shadow: 0 4px 8px rgba(0,0,0,0.3);
transition: opacity 0.3s ease;
opacity: 0;
}
#backToTopBtn.show {
display: block;
opacity: 1;
}
#backToTopBtn:hover {
background-color: #1e40af;
}