0

I have jquery carousel on my page with a few images. I find current image, get data-parameter and use it as background-image value for div

slideItems.removeClass('current');
slideItems.eq(currentSlide).addClass('current');
var current_image_src = $('.carousel .slideItem.current img').data('bg-image-src');
$('.conteiner').css('background-image', 'url(http:' + current_image_src + ')');

but with this code background image changes sharply.
Is there any way to change background image gradually using animate() ?

hronikata
  • 107
  • 10
  • possible duplicate of [Animate background image change with jQuery](http://stackoverflow.com/questions/2983957/animate-background-image-change-with-jquery) or [How do I change the background image using jQuery animation?](http://stackoverflow.com/questions/4630947/how-do-i-change-the-background-image-using-jquery-animation) – Patrick Q Nov 20 '14 at 14:13

1 Answers1

-1

One of the solutions would be adding transition: background-image 1s to your conteiner class, and then just change the background image.

FIDDLE

Holybreath
  • 403
  • 2
  • 8