I'd like to show one html file. Then fade to another one. Here's my code and it works, except the first time, it waits 10 seconds to switch. Then after the switch, it waits 5 seconds in between switches. I'm a little confused as to how to jquery's handles timeouts and waits. I'd like to wait 5 seconds per switch, beginning with the first one.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
$(document).ready(function() {
$("#responsecontainer3").load("ad1.html");
var refreshId = setInterval(function() {
$("#responsecontainer3").fadeTo("slow").load('ad1.html?randval='+ Math.random());
setTimeout(function()
{
$("#responsecontainer3").fadeTo("slow").load('ad2.html?randval='+ Math.random());
}, 5000);
}, 10000);
});
</script>
<div id="responsecontainer3">
</div>