I'm trying to create a slideshow that will run in a DIV in the background while having links on top of it. The problem that I'm running into is that when I'm transitioning through pictures using the fadeIn and fadeOut JQuery functions, it is fading out the links as well. Is there a way to fade only the background image? My code is below:
<html>
<head>
<script type="text/javascript" src="jquery.js">
var bgimage=new Array()
bgimage[0] = 'bg_pic2.jpg';
bgimage[1] = 'bg_pic3.jpg';
bgimage[2] = 'bg_pic4.jpg';
bgimage[3] = 'cbg_pic5.jpg';
bgimage[4] = 'bg_pic1.jpg';
var abc=-1
function t()
{
if (abc<bgimage.length-1)
{
abc++;
}
else
{
abc=0;
}
document.getElementById("mainpic").style.backgroundImage = 'url("'+bgimage[abc]+'")';
$('#mainpic').fadeIn();
$('#mainpic').delay(3900).fadeOut();
}
window.onload = load;
function load()
{
$('#mainpic').hide();
$('#mainpic').delay(500).fadeIn();
document.getElementById("mainpic").style.backgroundImage = 'url(css/images/bg_pic1.jpg)';
setInterval("t()",5000); //change every 4 seconds, can be changed.
$('#mainpic').delay(3600).fadeOut();
}
//-->
</script>
</head>
<body>
<div id="container" >
<div id="mainpic" class="mainpic">
<div style="float:right; height: 531px; width: 20px"></div>
<br />
<div class="coaches"><a href=""></a></div>
<br />
<br />
<br />
<br />
<div class="hours"><a href=""></a></div>
<br />
<br />
<br />
<br />
<div class="pics"><a href=""></a></div>
<br />
<br />
<br />
<br />
<div class="blog"><a href=""></a></div>
</div>
</div>
</body>