Question

Why this is not working

$('#upload-title').css({ background: '#ffffff' }).delay(800).css({ background: '#00FF72' });

I want that my #upload-title. Is white for 0.5 sec. Thanks for help

Was it helpful?

Solution

You'll need to use a timeout, delay is meant for use with animations:

$('#upload-title').css({
    background : '#eeeeff'
});
setTimeout(function() {
    $('#upload-title').css({
        background : '#00FF72'
    });
}, 800);

OTHER TIPS

The delay method delays things in the effects queue, and css is not an effects method.

You can add the css call to the queue using the queue method:

$('#upload-title').css({ background: '#ffffff' }).delay(500).queue(function(){
  $(this).css({ background: '#00FF72' });
});

Demo: http://jsfiddle.net/Guffa/BxJ3Z/

.delay() works with animations, use jquery .animate() instead http://api.jquery.com/animate/

Jsfiddle

$(function() {
    setTimeout(
        function() {
            $('#upload-title').css({
                background: '#00FF72'
            });
        }, 500
    );
})
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top