redditor
redditor

Reputation: 4266

JQUERY - fade out specifc div, wait, fade div back in

I currently have this working fiddle - http://jsfiddle.net/B8Abd/

I would like to use jquerys fade out then fade in during the function. The code at the moment is this:

       function changetoYellow() {
//change the color of the div
       createGradientV([0, 0, 0], [255, 255, 0], 7, 200);
       }

I would like to have something like this:

       function changetoYellow() {
 //fade to black: 
       $("#fadeBandsV").fadeOut(1000);
//change the color of the div
       createGradientV([0, 0, 0], [255, 255, 0], 7, 200);
 //fade from black: 
       $("#fadeBandsV").fadeIn(1000);
       }

Thank you.

Upvotes: 4

Views: 601

Answers (1)

VisioN
VisioN

Reputation: 145368

How about this:

function changetoYellow() {
    $("#fadeBandsV").fadeOut(1000, function() {
        createGradientV([0, 0, 0], [255, 255, 0], 7, 200);
        $("#fadeBandsV").fadeIn(1000);
    });
}

DEMO: http://jsfiddle.net/B8Abd/1/

Upvotes: 7

Related Questions