简体   繁体   中英

In JQuery Cycle how do you get the src of the current slide?

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!

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM