jQuery - Multiple setInterval Conflict
- by Chris Bowyer
I am a jQuery novice and each of the following work fine on their own, but get out of time when working together. What am I doing wrong? Any improvement on the code would be appreciated too... It is to be used to rotate advertising.
<!--- Header Rotator --->
<script type="text/javascript">
$(document).ready(function() {
$("#header").load("header.cfm");
var refreshHeader = setInterval(function() {
$("#header").load("header.cfm");
}, 10000);
});
</script>
<!--- Main Rotator --->
<script type="text/javascript">
$(document).ready(function() {
$("#main").load("main.cfm");
var refreshMain = setInterval(function() {
$("#main").load("main.cfm");
}, 5000);
});
</script>
<!--- Footer Rotator --->
<script type="text/javascript">
$(document).ready(function() {
$("#footer").load("footer.cfm");
var refreshFooter = setInterval(function() {
$("#footer").load("footer.cfm");
}, 2000);
});
</script>