]> iEval git - plack-app-gruntmaster.git/commitdiff
Transition (background-)color on theme change
authorMarius Gavrilescu <marius@ieval.ro>
Mon, 20 Apr 2015 07:41:47 +0000 (10:41 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Mon, 20 Apr 2015 07:41:47 +0000 (10:41 +0300)
css/custom.css
js/90-themes.js

index 0188fd4dd470f40d26984c1133989e7d0fccafe4..fa66f23e0a647990580939da3796aef6d60652e3 100644 (file)
@@ -78,4 +78,8 @@ td.user, td.owner {
 
 #themes:before {
        content: " Themes: ";
-}
\ No newline at end of file
+}
+
+.transition-color, .transition-color * {
+       transition: color 0.5s ease-in, background-color 0.5s ease-in;
+}
index 1ff13ae747507fb94eabd89df71159a757e6970b..aa2cdc903ca6ffd9a576a90f18fe937850903676 100644 (file)
@@ -1,4 +1,8 @@
-function set_style(name){
+function set_style(name, trans){
+       if(trans){
+               document.body.classList.add('transition-color');
+               setTimeout(() => document.body.classList.remove('transition-color'), 1000);
+       }
        $('link[title]').each(e => e.disabled = true);
        $('link[title="' + name + '"]')[0].disabled = false;
        localStorage.setItem("theme", name);
@@ -11,12 +15,12 @@ $(function() {
                '<li><a role="button" data-theme="readable">White</a></ul>';
        var sidebar = $('#sidebar')[0];
        sidebar.insertBefore(m(theme_ul), sidebar.firstChild);
-       $('#themes a').on('click', e => set_style(e.target.dataset.theme));
+       $('#themes a').on('click', e => set_style(e.target.dataset.theme, true));
 });
 
 let theme = localStorage.getItem("theme");
 if(theme) {
        if(theme == "cerulean" || theme == "cosmo")
                theme = "readable";
-       set_style(theme);
+       set_style(theme, false);
 }
This page took 0.02358 seconds and 4 git commands to generate.