Search code examples
jquerycycle

I cant get slide title, ccle jQuery


having real problems getting the alt attr from the active cycle slide? Should i be using 'opts' at all to get this?

an pointers welcome!

$("div.backgroundImages").fadeIn(200).cycle({        
            fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
            timeout: 0,
            containerResize: false,
            speed: '450',
            height: '1000',
            slideExpr: 'div.backgroundSlide',
            next : 'div.backgroundImages',
            before:   onBefore,
        after:   onAfter
    });

    function onBefore(curr, next, opts){

    }   

    function onAfter(curr, next, opts){
        $('span.title').html(opts.currSlide.alt); // doesn't work?!

        var cnt = 'Image ' + (opts.currSlide + 1) + ' of ' + opts.slideCount; // works
        $('span.cnt').html(cnt);
    }

Solution

  • agh - it was just because i wasn't specifying the image as the slide!

    slideExpr: 'div.backgroundSlide',