Hello everyone!
I'm new here and I need some help. I want to change the background of a td element without losing the CSS styling that is currently applied to it. Right now, the background is repeating and tiling.
Below is the script I am using:
$(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 the CSS snippet I have:
.tdback{
border:2px solid #fff;
background-repeat:no-repeat;
background-position: left top;
}
And this is my HTML markup:
<td class="tdback" id="change1" height="50%" width="33%">