loading screen
parent
2a096ab1fd
commit
2c6c844532
|
@ -1,53 +1,48 @@
|
|||
{% assign content_type = content_type | default: 'body' %}
|
||||
|
||||
{% if content_type == 'body' %}
|
||||
<div id="shx-loading-screen"></div>
|
||||
<div id="shx-loading-screen"></div>
|
||||
{% elsif content_type == 'head' %}
|
||||
<style>
|
||||
#shx-loading-screen {
|
||||
display: block;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: white;
|
||||
z-index: 99999;
|
||||
transition: opacity 0.5s ease;
|
||||
opacity: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
<style>
|
||||
#shx-loading-screen {
|
||||
display: block;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: white;
|
||||
z-index: 99999;
|
||||
transition: opacity 0.5s ease;
|
||||
opacity: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.shx-loading-screen-hidden {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
.shx-loading-screen-hidden {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const loadingScreen = document.getElementById('shx-loading-screen');
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const loadingScreen = document.getElementById('shx-loading-screen');
|
||||
|
||||
// Ladebildschirm anzeigen
|
||||
function showLoadingScreen() {
|
||||
function showLoadingScreen() {
|
||||
loadingScreen.classList.remove('shx-loading-screen-hidden');
|
||||
}
|
||||
}
|
||||
|
||||
// Ladebildschirm ausblenden
|
||||
function hideLoadingScreen() {
|
||||
function hideLoadingScreen() {
|
||||
loadingScreen.classList.add('shx-loading-screen-hidden');
|
||||
}
|
||||
}
|
||||
|
||||
// Ladebildschirm beim Seitenwechsel
|
||||
window.addEventListener('beforeunload', function() {
|
||||
window.addEventListener('beforeunload', function() {
|
||||
showLoadingScreen();
|
||||
});
|
||||
});
|
||||
|
||||
// Ladebildschirm beim Laden der Seite ausblenden
|
||||
window.addEventListener('load', function() {
|
||||
window.addEventListener('load', function() {
|
||||
hideLoadingScreen();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</script>
|
||||
{% endif %}
|
Loading…
Reference in New Issue