I'd like to create a function that will cause the CSS background image of an element to change to a different image on click. Ideally, a second click would revert the image to the original, and so on.
I've searched this site for similar examples, and I was able to find some close examples, but nothing on the nose. Rather than pasting in some code I've found elsewhere, I'm hoping someone can take a look at my HTML/CSS in the Fiddle below and tell me what I need to do with the jQuery.
HTML:
<header id="switch">
<h1>
<span>Howie Mandel</span>
</h1>
<h2>
<span>Howie Doin</span>
</h2>
</header>
CSS:
header {
text-align: center;
padding-top: 4em;
background-image: url("https://media.timeout.com/images/102596453/image.jpg");
background-size: cover;
height: 10em;
background-position: bottom;
}
header-alt {
text-align: center;
padding-top: 4em;
background-image: url("https://upload.wikimedia.org/wikipedia/commons/c/c0/LA_San_Gabriel_Mountains.jpg");
background-size: cover;
height: 10em;
background-position: bottom;
}