简体   繁体   中英

Fading an image into another image

So I'm trying to make a slider with jQuery, but I can't get the effect right... I want it to be so when I click an image it fades into another one like on this slider: http://na.leagueoflegends.com

The normal fadeIn()/fadeOut() effects aren't exactly what I'm looking for, I want it to be smoother and also not to fade into black before the second image fades in.

Would putting two divs (one absolutely positioned over the other) and then fading the one on top work?

Thanks in advance, cheers!

Something like this should work

$("your img 1").animate({opacity : 0}, 300, function(){ // Fade out
    $("your img 2").animate({opacity : 1}, 200, function(){ // Fade in

    });
});

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