<!DOCTYPE html>
<html>
<style>
body, html {
height: 100%;
}
* {
box-sizing: border-box;
}
.bg-image {
/* The image used */
background-image: url('https://website.nl/images/image.jpg');
/* Add the blur effect */
filter: blur(8px);
-webkit-filter: blur(8px);
/* Full height */
height: 100%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
background-attachment: fixed;
background-color: rgba(0,0,0, 0.4); /* Black w/opacity/see-through */
}
/* Position text in the middle of the page/image */
.bg-text {
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0, 0.4); /* Black w/opacity/see-through */
color: white;
font-weight: bold;
border: 3px solid #f1f1f1;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 2;
width: 80%;
padding: 20px;
text-align: center;
}
.responsive {
width: 100%;
height: auto;
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: 10%;
}
</style>
<img id="weekdayimg" src="" width=200px class="center">
<script>
let dayoftheweekUri;
switch (new Date().getDay()) {
case 0:
dayoftheweekUri = "https://website.nl/images/sunday.jpg";
break;
case 1:
dayoftheweekUri = "https://website.nl/images/monday.jpg";
break;
case 2:
dayoftheweekUri = "https://website.nl/images/tuesday.jpg";
break;
case 3:
dayoftheweekUri = "https://website.nl/images/wednesday.jpg";
break;
case 4:
dayoftheweekUri = "https://website.nl/images/thursday.jpg";
break;
case 5:
dayoftheweekUri = "https://website.nl/images/friday.jpg";
break;
case 6:
dayoftheweekUri = "https://website.nl/images/saturday.jpg";
}
// Daarna vervangen we het van image element met id "weekdayimg" de src waarde
// en wordt het betreffende figuur getoond.
document.getElementById("weekdayimg").src= dayoftheweekUri;
</script>
<body>
<div class="bg-image"></div>
</body>
</html>