Skip to content

Commit

Permalink
fix scroll jump
Browse files Browse the repository at this point in the history
  • Loading branch information
cheryllium committed Jan 6, 2024
1 parent 1443801 commit e5d01a2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<br />

<div id="tabs">
<a href="#game">Aquarium</a>
<a href="#journal">Journal</a>
<a href="#game" id="game-link">Aquarium</a>
<a href="#journal" id="journal-link">Journal</a>
</div>
<div id="main">
<div id="game" class="tab">
Expand Down
13 changes: 9 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,16 @@ function setup() {
uiManager.updateFishInfo();
uiManager.createFishJournal();

document.querySelector("#game").addEventListener("click", function () {
journalOpen = false;
document.querySelector("#game-link").addEventListener("click", function (event) {
event.preventDefault();
journalOpen = false;
document.querySelector('#journal').classList.remove("active");
});
document.querySelector("#journal").addEventListener("click", function () {
journalOpen = true;
document.querySelector("#journal-link").addEventListener("click", function (event) {
event.preventDefault();
journalOpen = true;
console.log(document.querySelector('#journal'));
document.querySelector('#journal').classList.add("active");
});
}

Expand Down
2 changes: 1 addition & 1 deletion styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ button {
background-color: #7a8d9b;
display: none;
}
#journal:target {
#journal.active {
display: flex;
}
#fish-list, #fish-details {
Expand Down

0 comments on commit e5d01a2

Please sign in to comment.