Skip to content

Commit

Permalink
on escape scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
nrchtct committed Dec 11, 2023
1 parent 59951ea commit 0204ca8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@
document.querySelector("body").style.fontSize = fs+"px";
}
window.onresize = setFontSize;

// when pressing escape scroll up and remove hash
document.onkeyup = function(e) {
if (e.key === "Escape") {
window.scrollTo({ top: 0, left: 0, behavior: 'smooth' });
history.pushState("", document.title, window.location.pathname);
}
}
setFontSize();
fetch('data.md')
.then(data => data.text())
Expand Down
2 changes: 1 addition & 1 deletion js/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function updateItemPosition(item) {
item.x = item.left ? window.innerWidth * 0.05 + item.varianz : window.innerWidth * 0.95 + item.varianz

item.domObject.style.top = item.y + "px";
item.domObject.style.transform = 'translate(${item.varianz}px,0)'
item.domObject.style.transform = `translate(${item.varianz}px,0)`
}
function updateItemBase(item, session,itemIndex) {
item.type = item.markdown ? 'content' : 'actor'
Expand Down

0 comments on commit 0204ca8

Please sign in to comment.