]> _ Git - fluidbook-html5.git/commitdiff
wip #3869 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 7 Sep 2020 14:59:34 +0000 (16:59 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 7 Sep 2020 14:59:34 +0000 (16:59 +0200)
js/libs/fluidbook/fluidbook.background.js
style/fluidbook.less

index aa1cab5168847ae047f1cc75ede9ec38483af0a4..8a9b96f4c1189e458f2af7c6889f32997a377034 100644 (file)
@@ -1,6 +1,7 @@
 function FluidbookBackground(fluidbook) {
     this.fluidbook = fluidbook;
     this.hasLinks = false;
+    this.dynamicBackgroundColor = {};
     this.init();
 }
 
@@ -14,6 +15,20 @@ FluidbookBackground.prototype = {
             $("#background").prepend('<div class="links">' + this.fluidbook.settings.links.background + '</div>');
             this.hasLinks = true;
         }
+
+        if (Object.keys(this.fluidbook.settings.dynamicBackgroundColor).length > 0) {
+            var $this = this;
+            $(this.fluidbook).on('fluidbook.page.change.end', function (e, page) {
+                var c = $this.fluidbook.settings.dynamicBackgroundColor[page];
+                var style;
+                if (c === undefined || c === null || c === '' || c === '-') {
+                    style = '';
+                } else {
+                    style = "background-image:none !important;background-color:" + c + " !important;";
+                }
+                $('#background').attr('style', style);
+            });
+        }
     },
     resize: function (w, h) {
         if (!this.hasLinks) {
index 5b91a47a3b2fc87f0c41c4ea9d9b78f53595b7f2..219406ff9dead8054145c841fdbde823147aeea9 100644 (file)
@@ -178,6 +178,7 @@ body, html {
   width: 100%;
   height: 100%;
   z-index: 0;
+  //transition: background-color 350ms;
 }
 
 #background .links {