Skip to content

Commit

Permalink
pageYOffset deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
swift502 committed Jan 10, 2024
1 parent 4a47a1a commit 7213e80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/core/Navbar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ function tabHighlight(tabName: string)

<script>
let touchDevice = ('ontouchstart' in document.documentElement);
let prevScrollpos = window.pageYOffset;
let prevScrollpos = window.scrollY;

window.addEventListener('scroll', () =>
{
let navbar = document.getElementById("navbar");

if (touchDevice)
{
let currentScrollPos = window.pageYOffset;
let currentScrollPos = window.scrollY;
if (prevScrollpos > currentScrollPos)
{
navbar.style.top = "0";
Expand Down

0 comments on commit 7213e80

Please sign in to comment.