I have been developing a function and its doing kinda what I want it to do as shown above but am having an issue with it swapping two divs out at once and replacing with a different two, Anyone point me in the right direction am not sure how to go about this, Below is what I have got so far:
$(function () {
var counter = 0,
divs = $('#budgetSpent,#budgetTitle,#staticBudget,#staticTitle');
function showDiv () {
divs.hide() // hide all divs
.filter(function (index) { return index == counter % 3; }) // figure out correct div to show
.show('fast'); // and show it
counter++;
}; // function to loop through divs and show correct div
showDiv(); // show first div
setInterval(function () {
showDiv(); // show next div
}, 5 * 1000); // do this every 10 seconds
});
Short Description: So pretty much I have two counters, every 10 seconds the div is displayed and the rest are hidden, now It does swap, but the two div ids with title beside them, i cant get them to swap along with there respective counters so say for example: £0000 Budget1 (Displays for 10 seconds) then swaps to £11111 Budget2 and it should run in a loop, So far the 4 divs listed keep swapping one by one every setInterval But I need to show and hide 2 divs at a time rather than one by one