I need to create an effect in my slideshow that for every image displayed in the slideshow the background of div class="banner-backg"
change background-image.
For the slider I'm using link
: Slider HTML
<div class="banner-backg">
<div class="banner-center">
<ul class="bxslider">
<li><img src="images/banner_1.png" /></li>
<li><img src="images/banner_2.png" /></li>
<li><img src="images/banner_3.png" /></li>
</ul>
</div>
</div>
: jQuery
$('.bxslider').bxSlider({
adaptiveHeight: true,
mode: 'fade',
auto:true,
easing:'easeInOutCubic',
useCSS:false,
speed: 1000
});
One alternative I thought was to insert background-image manually for each image. Example:
<li><img src="images/banner_1.png" setimg="images/background_1jpg" /></li>
<li><img src="images/banner_2.png" setimg="images/background_2jpg" /></li>
In this, I would execute a jQuery that takes the value setimg
and applies as a background to div class="banner-backg"
. But I'm not really aware of how I can create this variable within img
.