Fade background image in and out with jQuery?

后端 未结 4 991
渐次进展
渐次进展 2020-11-27 21:52

So far, I\'ve tried a bunch of things to the effect of the following, without success:



        
4条回答
  •  孤街浪徒
    2020-11-27 22:41

    You can fade backgound-images! in and out!

    jQuery:

    $('#yourdiv').animate({opacity: 0}, 0).css("background-image", "url(image.jpeg)").animate({opacity: 1}, 2500);
    

    Edit:

    This will fade the whole div not onley the background-image.

提交回复
热议问题