Skip to content
This repository has been archived by the owner on Sep 19, 2020. It is now read-only.

Commit

Permalink
Defer the scripts loading
Browse files Browse the repository at this point in the history
  • Loading branch information
qzminski committed Aug 21, 2017
1 parent 251a2e8 commit 78fdb44
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion templates/modules/mod_mobile_switch.html5
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

<?php $this->block('content'); ?>

<?php $GLOBALS['TL_JAVASCRIPT'][] = \Haste\Util\Debug::uncompressedFile('system/modules/mobilecontent/assets/scripts.min.js'); ?>
<?php
if (!isset($GLOBALS['TL_HEAD']['mobilecontent'])) {
$GLOBALS['TL_HEAD']['mobilecontent'] = sprintf('<script src="%s" defer></script>', \Haste\Util\Debug::uncompressedFile('system/modules/mobilecontent/assets/scripts.min.js'));
}
?>

<div style="display:none;"
data-mobile-toggler="<?= $this->isMobile ? 'mobile' : 'desktop' ?>"
Expand Down

0 comments on commit 78fdb44

Please sign in to comment.