Skip to content

Commit

Permalink
Improve arrow logic
Browse files Browse the repository at this point in the history
  • Loading branch information
transcental committed Mar 31, 2023
1 parent 7182dad commit 6efb9eb
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ document.addEventListener("DOMContentLoaded", () => {

let rect = introSection.getBoundingClientRect();

if (rect.top == 0) {
link.setAttribute("href", "#new-projects");
arrow.style.display = "inline-block";
} else if (rect.top == -1018) {
link.setAttribute("href", "#old-projects");
if (rect.top == -4072) {
arrow.style.display = "none";
} else if (rect.top <= -3054) {
link.setAttribute("href", "#contact");
arrow.style.display = "inline-block";
} else if (rect.top == -2036) {
} else if (rect.top <= -2036) {
link.setAttribute("href", "#about");
arrow.style.display = "inline-block";
} else if (rect.top == -3054) {
link.setAttribute("href", "#contact");
} else if (rect.top <= -1018) {
link.setAttribute("href", "#old-projects");
arrow.style.display = "inline-block";
} else {
arrow.style.display = "none";
}
} else if (rect.top <= 0) {
link.setAttribute("href", "#new-projects");
arrow.style.display = "inline-block";
}

});

document.querySelector(".new-cards").addEventListener("mousemove", (e) => {
Expand Down

1 comment on commit 6efb9eb

@vercel
Copy link

@vercel vercel bot commented on 6efb9eb Mar 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please # to comment.