Fix for theme switcher

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
SkayyHH
Veteran Member
Posts: 460
Joined: 2015-04-27 21:18

Fix for theme switcher

Post by SkayyHH » 2024-09-29 16:02

Anyone who notices flickering with the theme switcher can use this fix in header-extras.php. It loads the themes before any flickering occurs.


<script>
(function() {
var theme = localStorage.getItem('theme') || 'light.css'; // Default ist Light Theme
var prePath = <?php echo json_encode(PREPEND_PATH); ?>;
if(theme) {
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = prePath + 'resources/initializr/css/' + theme;
document.head.appendChild(link);
}
})();
</script>

User avatar
a.gneady
Site Admin
Posts: 1319
Joined: 2012-09-27 14:46
Contact:

Re: Fix for theme switcher

Post by a.gneady » 2024-09-30 13:39

Thanks for sharing!
:idea: AppGini plugins to add more power to your apps:

Post Reply