Skip to content

Commit

Permalink
changed scroll to top functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
hkhaung committed Feb 14, 2024
1 parent 3d2b628 commit efc4b09
Show file tree
Hide file tree
Showing 3 changed files with 292 additions and 108 deletions.
4 changes: 4 additions & 0 deletions hw1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,10 @@ <h3>Task 6: "Level sampling" with mipmaps for texture mapping</h3>
// Function to scroll to the top of the page
function scrollToTop() {
window.scrollTo({ top: 0, behavior: "smooth" });
if (history.replaceState) {
var urlWithoutHash = window.location.href.split("#")[0];
history.replaceState(null, null, urlWithoutHash);
}
}

// Show/Hide scroll-to-top button based on scroll position
Expand Down
Loading

0 comments on commit efc4b09

Please sign in to comment.