JQUERY - 淡出特定的div,淡入淡出div

时间:2012-05-10 12:50:31

标签: javascript jquery

我目前有这个工作小提琴 - http://jsfiddle.net/B8Abd/

我想在功能期间使用jquerys淡出然后淡入淡出。目前的代码是:

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

我想有这样的事情:

       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);
       }

谢谢。

1 个答案:

答案 0 :(得分:7)

这个怎么样:

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

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