tags:

views:

39

answers:

2

hello i'm trying to make a div have a background image but only for a specific time: pseudo code: div has background image, after 1 sec passed div has background none, anyway doing this in jquery? regards

+3  A: 

You can try delay in jQuery 1.4+

$('#someDivID').delay(1000).css('background', 'none');

Otherwise you can use setTimeout:

setTimeout(function() { $('#someDivID').css('background', 'none'); }, 1000);

Jacob Relkin
sorry , the numbers of milli or sec is whatever.(my bad for the syntax)
tada
@tada it's in miliseconds. A good way of finding that out is just googling *setTimeout javascript* and looking at what comes up.
Pim Jager
A: 
$("div.removebg")
    .delay(1000000) // miliseconds
    .animate{
    background: 'none'
}, 
100);
Marko
This is wrong. 1000 milliseconds = 1 second.
Jacob Relkin
The question asks for a 1000/sec delay, which can be understood as 1 million ms...
jball
Yeah I thought 1000 sec - he should've written 1 second if he wanted 1000ms
Marko