Hi all -
I'm trying to create individual, different backgrounds for each page based on what tag they have. I've done this by inserting this as a script into the custom HTML:
$(document).ready(function() {
if ($('header[style*="rgb(193, 91, 169)"]').length ) {
$('html,body').addClass('background1');
}
});
and this into the custom CSS:
.background1 {
background:url("https://i.imgur.com/e4zukj2.png") top center no-repeat fixed;
background-size:cover;
}
When I load a page whose header is default coloured rgb(193, 91, 169)
, the page background shows https://i.imgur.com/e4zukj2.png instead of the normal background - such as on this page: https://meihua.freeflarum.com/t/test
However, the problem is that because flarum doesn't reload the whole structure (and not the body styles) when you go to another inside-flarum page, that special background stays even though it doesn't match the page. Vice versa, if you access https://meihua.freeflarum.com/t/test by clicking on the link from the forum's main page, you never see the custom background because flarum doesn't reload the background image and see that there's a new one.
I don't know the core well enough to figure out what causes that function and how to get around it so the correct background shows up - so does anyone here have a solution? Would be much appreciated ?