For this new website I'm creating, I'm trying to get one background to fade into another when I hover on a link. I don't want the link to change, just the background. I found some good jQuery to get the background to change, but there's no fade effect and my knowledge of jQuery is limited. Here's what I have so far:
Html
<div id="container">
<a id="linktomouseover" href="http://delusion.submittable.com/submit" alt="Submit to Delusion" style="position: absolute; width: 275px; height: 99px; top: 354px; left: 263px; display: block;"> </a>
</div>
Css
#container {
position:relative;
height:600px;
width:800px;
margin:0 auto;
background: url(Images/website-header1.png) center top no-repeat;
border: 1px solid #ffffff;
}
JQuery
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script>
<script>
$(function() {
$("#container a").hover(function() { // Changes the #main divs background to the rel property of the link that was hovered over.
$("#container").css("background", "url(Images/website-header2.png)");
}, function() { // Sets the background back to the default on hover out
$("#container").css("background", "url(Images/website-header1.png)");
});
});
</script>
If anyone has any other suggestions on how to do this, that would be great. This is just what I found. Thank you so much for helping!