Question

Im trying to work out the way to find the source of the current slide using JQuery cycle. I will be taking the source and using it to match the background image of another div using the 'after' method, it will change with each slide. This is what I have so far, all I need is to correct the var slideURL:

$('.home-slider').cycle({ pager: '.slider-pager', pause: '1', after: onSlideAfter });

        function onSlideAfter() {

            var slideURL = currSlide.content.find('img').attr('src');

Thanks in advance!

Was it helpful?

Solution

you can get the current source like this

$('.home-slider').cycle({ pager: '.slider-pager', pause: '1', after: onSlideAfter });
function onSlideAfter() {
    var slideURL =this.src;
}        

http://jsfiddle.net/dWstA/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top