Skip to content

Commit 6eaa222

Browse files
committed
COA
1 parent 4322a42 commit 6eaa222

3 files changed

Lines changed: 53 additions & 0 deletions

File tree

PAL/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,11 @@ <h4 class="mt-2 mb-3 text-primary-theme fw-bold">Booth's Algorithm Visualizer</h
745745
<!-- Dependencies -->
746746
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
747747

748+
<!-- Back to Top Button -->
749+
<button type="button" class="btn" id="btn-back-to-top" aria-label="Back to Top">
750+
<i class="fas fa-arrow-up" aria-hidden="true"></i>
751+
</button>
752+
748753
<!-- Custom Scripts -->
749754
<script src="script.js"></script>
750755

PAL/script.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,3 +556,22 @@ document.addEventListener('keydown', (e) => {
556556
return false;
557557
}
558558
});
559+
560+
// =========================================
561+
// BACK TO TOP BUTTON
562+
// =========================================
563+
const backToTopBtn = document.getElementById('btn-back-to-top');
564+
565+
if (backToTopBtn) {
566+
window.addEventListener('scroll', () => {
567+
if (window.scrollY > 300) {
568+
backToTopBtn.style.display = 'flex';
569+
} else {
570+
backToTopBtn.style.display = 'none';
571+
}
572+
});
573+
574+
backToTopBtn.addEventListener('click', () => {
575+
window.scrollTo({ top: 0, behavior: 'smooth' });
576+
});
577+
}

PAL/style.css

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,3 +1347,32 @@ section {
13471347
font-size: 0.8rem;
13481348
animation: bounce 2s infinite;
13491349
}
1350+
1351+
/* =========================================
1352+
BACK TO TOP BUTTON
1353+
========================================= */
1354+
#btn-back-to-top {
1355+
position: fixed;
1356+
bottom: 25px;
1357+
right: 25px;
1358+
display: none;
1359+
z-index: 1000;
1360+
border-radius: 50%;
1361+
width: 45px;
1362+
height: 45px;
1363+
background: var(--accent-color);
1364+
color: white;
1365+
border: none;
1366+
box-shadow: var(--shadow-md);
1367+
transition: all 0.3s;
1368+
align-items: center;
1369+
justify-content: center;
1370+
font-size: 1.2rem;
1371+
}
1372+
1373+
#btn-back-to-top:hover {
1374+
transform: translateY(-5px);
1375+
background: var(--accent-color);
1376+
filter: brightness(1.1);
1377+
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
1378+
}

0 commit comments

Comments
 (0)