0

Is it possible to assign time span to background-image of DIV ?

Do you guys know if I can do it with jQuery or not ? I want first image to stay 20 seconds and second image to stay 5 seconds. So they should change each other.

Extelliqent
  • 1,760
  • 5
  • 32
  • 51

2 Answers2

1

Use something like this in your document ready...

setTimeout("ChangeToBlue();", 20000);

Then... the function...

function ChangeToBlue()
{
    $("#background").css("background-color", "blue");
}

I'm setting the background to a color... but same idea. If you want it to switch back and forth, set another timeout in the function.

Trent
  • 1,280
  • 11
  • 12
1

You can use fadeToggle like this http://jsfiddle.net/cwsUF/1/

Jay
  • 1,384
  • 1
  • 17
  • 30