Frage

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!

War es hilfreich?

Lösung

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/

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top