0
I need to create an effect on my slideshow that for each image displayed in the slideshow the background of div class="banner-backg"
change the background-image.
For the slider I’m using the http://bxslider.com/options
: HTML by Slider
<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
});
An alternative I thought was to manually insert the background-image 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 that, I would run a jQuery that took the value setimg
and applied as background in div class="banner-backg"
. But I don’t have much knowledge of how I can create this variable within the img
.
You can do this with Callbacks functions, in his documentation you can do it.
– Ivan Ferrer
I tried to use onSlideNext but it only works by changing the background color, I don’t know how I can capture the image path .
– Wesley