add randomized background images

This commit is contained in:
Mark Eaton
2026-02-07 22:34:36 -05:00
parent 5ab9ecc723
commit ddcb471eac
2 changed files with 16 additions and 6 deletions
-6
View File
@@ -204,12 +204,6 @@
/* style background image */ /* style background image */
.kbcc-background-image { .kbcc-background-image {
background: linear-gradient(
to bottom,
rgba(255, 255, 255, 0.6) 0%,
rgba(255, 255, 255, 0.6) 100%
),
url("https://libapps.s3.amazonaws.com/accounts/16298/images/library_front_view.jpg");
background-position: 50% 71%; background-position: 50% 71%;
padding: 20px 0; padding: 20px 0;
border-radius: 5px; border-radius: 5px;
+16
View File
@@ -436,3 +436,19 @@ const app2 = createApp({
}); });
app2.mount("#app2"); app2.mount("#app2");
// Randomly set the background image for .kbcc-background-image
(function () {
const images = [
"https://libapps.s3.amazonaws.com/accounts/16298/images/library_front_view.jpg",
"https://d2jv02qf7xgjwx.cloudfront.net/accounts/16298/images/copy_for_it.jpg",
"https://d2jv02qf7xgjwx.cloudfront.net/accounts/16298/images/Library_Website_Background_Images_005.jpg",
"https://d2jv02qf7xgjwx.cloudfront.net/accounts/16298/images/Library_Website_Background_Images_002.jpg",
];
var picked = images[Math.floor(Math.random() * images.length)];
var el = document.querySelector(".kbcc-background-image");
if (el) {
el.style.backgroundImage =
"linear-gradient(to bottom, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0.6) 100%), url('" + picked + "')";
}
})();