n00b here..
I want to be able to retain the CSS attached to the td that I'm changing. Currently the background is tiling.
Script:
$(function () {
var change1 = $('#change1');
var backgrounds = [
'url(http://content.abt.com/media/images/promos/change1abe.jpg)',
'url(http://content.abt.com/media/images/promos/change1fish.jpg)',
'url(http://content.abt.com/media/images/promos/change1abe.jpg)'];
var current = 0;
function nextBackground() {
change1.css(
'background',
backgrounds[current = ++current % backgrounds.length]);
setTimeout(nextBackground, 5000);
}
setTimeout(nextBackground, 5000);
change1.css('background', backgrounds[0]);
});
Here is my CSS:
.tdback{
border:2px solid #fff;
background-repeat:no-repeat;
background-position: left top;
}
And my HTML:
<td class="tdback" id="change1" height="50%" width="33%">