From 4e933434b34fd53aac935bf3042b0aa62f616665 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 7 Sep 2020 16:59:34 +0200 Subject: [PATCH] wip #3869 @1.5 --- js/libs/fluidbook/fluidbook.background.js | 15 +++++++++++++++ style/fluidbook.less | 1 + 2 files changed, 16 insertions(+) diff --git a/js/libs/fluidbook/fluidbook.background.js b/js/libs/fluidbook/fluidbook.background.js index aa1cab51..8a9b96f4 100644 --- a/js/libs/fluidbook/fluidbook.background.js +++ b/js/libs/fluidbook/fluidbook.background.js @@ -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(''); 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) { diff --git a/style/fluidbook.less b/style/fluidbook.less index 5b91a47a..219406ff 100644 --- a/style/fluidbook.less +++ b/style/fluidbook.less @@ -178,6 +178,7 @@ body, html { width: 100%; height: 100%; z-index: 0; + //transition: background-color 350ms; } #background .links { -- 2.39.5