Skip to content

Commit

Permalink
fix link bug at projects
Browse files Browse the repository at this point in the history
  • Loading branch information
elproffesore committed Feb 20, 2024
1 parent e6bb773 commit 210b3d5
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/syllabussite.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,23 @@ function update() {
sessions.map(session => {
let sessionProgress = (window.scrollY - session.margin) / session.height;
let [cursorPosition, cursorHeight] = updateCursor(session, sessionProgress)
if (session.anchor != undefined) {
if (session.margin <= window.scrollY && window.scrollY <= (session.margin + session.height)) {
if (session.margin <= window.scrollY && window.scrollY <= (session.margin + session.height)) {
if (session.anchor != undefined) {
session.anchor.classList.add('active');
let anchor1 = [window.innerWidth / 2, cursorPosition + cursorHeight / 2];
session.items.map((item) => {
let bounding = item.domObject.getBoundingClientRect();
let anchor4 = [bounding.left + bounding.width / 2, bounding.top + bounding.height / 2];
item.linePath = [...anchor1, ...anchor4];
});
links.push(session.items)
} else {
}
let anchor1 = [window.innerWidth / 2, cursorPosition + cursorHeight / 2];
session.items.map((item) => {
let bounding = item.domObject.getBoundingClientRect();
let anchor4 = [bounding.left + bounding.width / 2, bounding.top + bounding.height / 2];
item.linePath = [...anchor1, ...anchor4];
});
links.push(session.items)
}else{
if (session.anchor != undefined) {
session.anchor.classList.remove('active');
}
}

})
updateLinks(links.flat());
}
Expand Down

0 comments on commit 210b3d5

Please sign in to comment.