diff options
author | Darshan Baral <darshanbaral@gmail.com> | 2019-07-20 19:15:23 +0300 |
---|---|---|
committer | Darshan Baral <darshanbaral@gmail.com> | 2019-07-20 19:15:23 +0300 |
commit | 7a14f4e0eb4d001f2e11fdc0914a9f74ef311f01 (patch) | |
tree | 8bfd78f1608af770ed23609849175a8f9880cfbb | |
parent | 3a4879fffa13ca65e17db431113f8c2033278835 (diff) |
Added type to colorCSS
-rw-r--r-- | layouts/partials/head.html | 1 | ||||
-rw-r--r-- | layouts/partials/toggleTheme.html | 20 |
2 files changed, 11 insertions, 10 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 8d160e2..f2b9fea 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -26,6 +26,7 @@ id="color-CSS"
rel="stylesheet"
href="{{ print `/css/aafu_` .Site.Params.theme.mainTheme `.css` | relURL }}"
+ type="text/css"
/>
<link rel="stylesheet" href="{{ `/css/aafu.css` | relURL }}" />
diff --git a/layouts/partials/toggleTheme.html b/layouts/partials/toggleTheme.html index 457921e..912c9d7 100644 --- a/layouts/partials/toggleTheme.html +++ b/layouts/partials/toggleTheme.html @@ -9,25 +9,25 @@ </div> <script> - let mainTheme = + const mainTheme = "{{ print `/css/aafu_` .Site.Params.theme.mainTheme `.css` | absURL }}"; - let altTheme = + const altTheme = "{{ print `/css/aafu_` .Site.Params.theme.altTheme `.css` | absURL }}"; - let toggleTheme = function(elem) { + const currentCSS = document.querySelector("#color-CSS"); + function toggleTheme(elem) { elem.classList.toggle("fa-toggle-off"); elem.classList.toggle("fa-toggle-on"); - let currentCSS = document.querySelector("#color-CSS"); if (currentCSS.href.includes(mainTheme)) { - currentCSS.href = altTheme; + currentCSS.setAttribute("href", altTheme); } else { - currentCSS.href = mainTheme; + currentCSS.setAttribute("href", mainTheme); } - }; + } - let changeThemeColor = function() { + function changeThemeColor() { themeColor.content = getComputedStyle(document.body)["background-color"]; - }; - let thisBody = document.body; + } + const thisBody = document.body; thisBody.addEventListener("webkitTransitionEnd", changeThemeColor); thisBody.addEventListener("transitionend", changeThemeColor); </script> |