I want the visitors of my web page to able to change the background of my web page when they click a link. I have few skills in javascript and jquery and am not sure how exactly to achieve this. Do display my background i use the following css:
#background {
width: 100%;
height: 100%;
position: fixed;
left: 0px;
top: 0px;
z-index: -1;
}
.stretch {
width:100%;
height:100%;
}
and html -
<img src="images/backgrnd.jpg" class="stretch" id="background" alt="" />
Changing an image's src attribute in jquery is simple:
$('#background').attr('src', 'images/newimage.jpg');