Skip to content

Commit 559c1b2

Browse files
Merge pull request #45 from beavertronics/fix-cal-hiding
2 parents c062530 + 6ffe70c commit 559c1b2

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

landing/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<link rel="icon" type="image/png" href="/assets/header/ravioli.png"/>
1515
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
1616
<script src="/shared/JS/script.js"></script>
17-
<script src="/index.js"></script>
17+
<script src="index.js"></script>
1818
<script src="/shared/JS/slideshow.js"></script>
1919
<link rel="stylesheet" href="/shared/css/fonts.css"/>
2020
<link rel="stylesheet" href="/shared/css/style.css"/>

landing/index.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@ const CALENDAR_MINIMUM_WIDTH = 850; // I found this number by shrinking the page
33

44
// runs when the page is done loading
55
// calls on the on_resize function for loading page
6-
window.addEventListener('load', function () {
6+
window.addEventListener('resize', showhide);
7+
window.addEventListener('load', showhide);
8+
9+
function showhide() {
710
let current_screen_width = window.innerWidth
811

912
// if the windows width is less then the minimum calender width,
1013
// remove the calendar and display alternate text that the page is too small
1114
// and redirect them to the calendar externally
1215
if (current_screen_width <= CALENDAR_MINIMUM_WIDTH) {
13-
document.getElementById("google calendar").remove()
14-
document.getElementById("alt calendar text").classList.toggle("hidden")
15-
}
16-
})
16+
document.getElementById("google calendar").classList.add("hidden")
17+
document.getElementById("alt calendar text").classList.remove("hidden")
18+
} else {
19+
document.getElementById("google calendar").classList.remove("hidden")
20+
document.getElementById("alt calendar text").classList.add("hidden")
21+
}
22+
}

0 commit comments

Comments
 (0)