theme blink bug fixed
This commit is contained in:
parent
e050e0f374
commit
b82244ab9b
|
@ -2,7 +2,6 @@ $(document).ready(function() {
|
||||||
// theme change
|
// theme change
|
||||||
var localTheme = localStorage.getItem('theme');
|
var localTheme = localStorage.getItem('theme');
|
||||||
if (localTheme) {
|
if (localTheme) {
|
||||||
$('#root').attr('class', `theme__${localTheme}`);
|
|
||||||
$('.select-theme__item').each(function () {
|
$('.select-theme__item').each(function () {
|
||||||
$(this).removeClass('is-active');
|
$(this).removeClass('is-active');
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,6 +13,12 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body id="root" class="theme__{{ index .Site.Params.themeOptions 0 }}">
|
<body id="root" class="theme__{{ index .Site.Params.themeOptions 0 }}">
|
||||||
|
<script>
|
||||||
|
var localTheme = localStorage.getItem('theme');
|
||||||
|
if (localTheme) {
|
||||||
|
document.getElementById('root').className = `theme__${localTheme}`;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<div id="body">
|
<div id="body">
|
||||||
<div class="container wrapper">
|
<div class="container wrapper">
|
||||||
{{ partial "navbar/site-nav" . }}
|
{{ partial "navbar/site-nav" . }}
|
||||||
|
|
Loading…
Reference in New Issue