Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Binary file added assets/backToTop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions boneset-api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions boneset-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"axios": "^1.8.4",
"cors": "^2.8.5",
"digitalbonesbox": "file:..",
"dotenv": "^16.4.7",
"express": "^4.21.2",
"express-rate-limit": "^8.1.0"
Expand Down
4 changes: 4 additions & 0 deletions templates/boneset.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,15 @@ <h3>Description</h3>
<div id="annotations-overlay"></div>
</div>
</div>
<button id="backToTopBtn">
<img src="../assets/backToTop.png" alt="Back to Top" width="50px" height="50px">
</button>
</div>

<script type="module" src="js/search.js"></script>
<script type="module" src="js/sidebar.js"></script>
<script type="module" src="js/main.js"></script>
<script type="module" src="js/BackToTopButton.js"></script>
</body>

</html>
16 changes: 16 additions & 0 deletions templates/js/BackToTopButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const backToTopBtn = document.getElementById('backToTopBtn')

Check failure on line 1 in templates/js/BackToTopButton.js

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon

Check failure on line 1 in templates/js/BackToTopButton.js

View workflow job for this annotation

GitHub Actions / lint

Strings must use doublequote

window.addEventListener('scroll', () => {

Check failure on line 3 in templates/js/BackToTopButton.js

View workflow job for this annotation

GitHub Actions / lint

Strings must use doublequote
if (document.documentElement.scrollTop > 20) {
backToTopBtn.classList.add('show')

Check failure on line 5 in templates/js/BackToTopButton.js

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon

Check failure on line 5 in templates/js/BackToTopButton.js

View workflow job for this annotation

GitHub Actions / lint

Strings must use doublequote
} else {
backToTopBtn.classList.remove('show')

Check failure on line 7 in templates/js/BackToTopButton.js

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon

Check failure on line 7 in templates/js/BackToTopButton.js

View workflow job for this annotation

GitHub Actions / lint

Strings must use doublequote
}
})

Check failure on line 9 in templates/js/BackToTopButton.js

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon

backToTopBtn.addEventListener('click', () => {

Check failure on line 11 in templates/js/BackToTopButton.js

View workflow job for this annotation

GitHub Actions / lint

Strings must use doublequote
window.scrollTo({
top: 0,
behavior: 'smooth',

Check failure on line 14 in templates/js/BackToTopButton.js

View workflow job for this annotation

GitHub Actions / lint

Strings must use doublequote
})
})
26 changes: 26 additions & 0 deletions templates/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -445,3 +445,29 @@ ul li {
}
}


/* Back To Top */

#backToTopBtn {
position: fixed;
bottom: 20px;
right: 30px;
z-index: 99;
border: none;
cursor: pointer;
padding: 0;
border-radius: 10px;
transition: opacity 0.3s ease, bottom 0.3s ease;
opacity: 0;
overflow: hidden;
pointer-events: none;
}

#backToTopBtn.show {
opacity: 1;
pointer-events: auto;
}

#backToTopBtn:hover {
bottom: 15px;
}