jQuery change div background-image with fadeIn/Out

前端 未结 6 851
挽巷
挽巷 2020-12-19 01:02

I\'m trying to create a fadeIn/Out effect on a site I created (edit: site url deleted)

Everything works great except when you click on one of the colors in the color

6条回答
  •  悲哀的现实
    2020-12-19 01:42

    You might want to try something like this

    Replace

    $('#image-holder').css("background", "url('images/design-" + newColor + ".jpg')");

    with

    $('#image-holder').animate({background : url('images/design-' + newColor + '.jpg') }, 3000);

    Adjust the 3000 as necessary to increase the amount of time in the animation.

    Totally untested

提交回复
热议问题