简体   繁体   中英

fadeout works, but fadein doesn't

As the title states, I have a function that causes a div to fadeOut

 $("#myVid").bind("ended", function() {
            //other functions
            $(".control").animate( {
                marginTop: "+=128px"}, 500 );
            $(".control").fadeOut(0);
        });

and the one where it fades in

$("#myVid").bind("playing", function() {
            //other functions
        $(".control").fadeIn(0);
        });

why isn't it coming back in? the video is actually an array, so that's why it fade out on ended and back in on playing... can I get some help here?

should this be possible:

 $(".control").fadeOut(0).delay(500).fadeIn(0); 

because delay() s always give me tons of trouble, and now is just delaying the whole ended function(if in front) or doesn't go first(if in back)

I personally use two functions for when i'm using fades:

function fadeIn(id){
    $('#'+id).fadeIn('fade', function() {
    });
}
function fadeOut(id){
    $('#'+id).fadeOut('fade', function() {
    });
}

So you could work with those

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM