Skip to content

Commit

Permalink
Fix: hide iframe when reload
Browse files Browse the repository at this point in the history
  • Loading branch information
Chimildic committed Jul 28, 2024
1 parent 8e642d4 commit 65cc768
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</div>
</div>
</div>
<iframe onload="onIframeLoaded(this)" src="https://script.google.com/macros/s/AKfycbz99NP1EXi_2sXT7GoQp1exM_MvpsFtL1YYfaNXVz1q8XPrrR4dnIqfLdkHn9muK35XsA/exec"></iframe>
<iframe id="iframe-service" src="https://script.google.com/macros/s/AKfycbz99NP1EXi_2sXT7GoQp1exM_MvpsFtL1YYfaNXVz1q8XPrrR4dnIqfLdkHn9muK35XsA/exec"></iframe>
<div class="container">
<footer class="py-3 my-4">
<ul class="nav justify-content-center border-bottom pb-3 mb-3">
Expand All @@ -56,11 +56,21 @@
</footer>
</div>
<script>
const spinnerElement = document.getElementById('spinner-root')
const iframeElement = document.getElementById('iframe-service')

window.onbeforeunload = onLoading
iframeElement.onload = onReady
setCopyright()

function onIframeLoaded(iframeElement) {
document.getElementById('spinner-root').style.display = 'none'
iframeElement.style.display = 'initial'
function onLoading() {
spinnerElement.style.display = 'block'
iframeElement.style.display = 'none'
}

function onReady() {
spinnerElement.style.display = 'none'
iframeElement.style.display = 'block'
}

function setCopyright() {
Expand Down

0 comments on commit 65cc768

Please sign in to comment.