Skip to content

Commit

Permalink
Avoid interactive chart flashing first on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbelgium authored Oct 30, 2024
1 parent 5a2e390 commit f6cd0e6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ function setModalText(iter, title, text, authorlink, photolink, licenseurl) {
<div class="right-column">
<div class="center-column">
</div>
<div class="chart">
<div class="chart" style="visibility: hidden;">
<?php
$refresh = $config['RECORDING_LENGTH'];
$dividedrefresh = $refresh/4;
Expand All @@ -331,9 +331,13 @@ function setModalText(iter, title, text, authorlink, photolink, licenseurl) {
}
?>
<script>
if (window.innerWidth <= 800) {
document.querySelector('.chart').innerHTML = '<img id="chart" src="Charts/<?php echo $chart; ?>?nocache=<?php echo $time; ?>">';
}
document.addEventListener("DOMContentLoaded", function() {
const chartContainer = document.querySelector('.chart');
if (window.innerWidth <= 800) {
chartContainer.innerHTML = '<img id="chart" src="Charts/<?php echo $chart; ?>?nocache=<?php echo $time; ?>">';
}
chartContainer.style.visibility = 'visible';
});
</script>
</div>

Expand Down

0 comments on commit f6cd0e6

Please sign in to comment.