Currently, I have a static image in the header of the page. I'm looking to have the image change to a different one when half the page has been scrolled.
Do I need to utilize JavaScript for this functionality or is it achievable with CSS alone?
body {
height:1200px;
width:100%;
background-color:#fbfbfb;
}
.header_nav {
width:100%;
height:150px;
background-color:#666;
position:fixed;
top:0;
left:0;
color:#fff;
background-repeat: no-repeat;
background-position: center center;
}
img {
width: 150px;
display: block;
margin: 0 auto;
}
<div class="header_nav"><img src="https://i.picsum.photos/id/244/200/200.jpg?hmac=Q1gdvE6ZPZUX3nXkxvmzuc12eKVZ9XVEmSH3nCJ2OOo"></div>