Skip to content

Commit

Permalink
Merge pull request #136 from HarryDulaney/jquery-impl-fix
Browse files Browse the repository at this point in the history
Fix mobile reload loader doesn't hide bug
  • Loading branch information
HarryDulaney authored Nov 5, 2023
2 parents e15aafc + e477814 commit c5efe91
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
1 change: 0 additions & 1 deletion css/intro.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* -------------------------------------------------- Intro ------------------------------------------------------ */
.intro--wrapper {
position: relative;
overflow-x: hidden !important;
background-color: var(--bgcolor-primary);
min-height: 100vh !important;
height: fit-content !important;
Expand Down
7 changes: 2 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,7 @@
<script src="./js/contact.js"></script>
<script src="./js/about.js"></script>
<script src="./js/download.js"></script>
<script
defer
src="./js/app.js"
></script>
<script src="./js/app.js"></script>
<!-- Google tag (gtag.js) -->
<script
async
Expand Down Expand Up @@ -1935,5 +1932,5 @@ <h2>contact.</h2>
</footer>
</div>
</body>

<script defer src="./js/load.js"></script>
</html>
15 changes: 3 additions & 12 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,12 @@ $(function () {
$('#mobile-nav-icon').removeClass('open');
}
});

$(window).on('load', router);
$(window).on('hashchange', router);
/* =============== Window Event Binding ============== */
$(window).on('beforeunload', function () {
sessionStorage.setItem(PAGE_RELOADED_STORAGE_KEY, 'reloaded');
INITIALIZED = false;
});
$(window).on('resize', onWindowResize);

});

/**
Expand Down Expand Up @@ -552,13 +549,6 @@ function toggleTheme() {
}
}

function onBodyLoaded() {
isLoading = true;
if (IS_RELOADED) {
hideLoader();
}
}

function setLightTheme(page) {
switch (page) {
case 'intro':
Expand Down Expand Up @@ -623,4 +613,5 @@ function showArrow(element) {

function hideArrow(timeline) {
timeline.reverse();
}
}

12 changes: 12 additions & 0 deletions js/load.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

function load() {
router();
if (IS_RELOADED) {
hideLoader();
sessionStorage.setItem(PAGE_RELOADED_STORAGE_KEY, null);
console.log('Page reloaded');
}
}

$(window).on('load', load);
$(window).on('hashchange', load);

0 comments on commit c5efe91

Please sign in to comment.