tags:

views:

25

answers:

3

hello!

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);
    }
A: 

is this what you are asking for (this.alt) ? http://jquery.malsup.com/cycle/int2.html#s5

ifaour
it is but its not working – i just get 'undefined'. think i'll try some other releases. Thanks and will let you know what happens...
daniel Crabbe
ummm, I'm just wondering...are you wrapping your images with a div or any element? because in that case "this" will return that element and the image(child element).
ifaour
A: 

ok - not the best soltion bt

$('div.title').html($('div.backgroundSlide:visible img').attr("alt"));

is how i got arond it. Odd how the proper method wont work....

Dan

daniel Crabbe
A: 

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

slideExpr: 'div.backgroundSlide',
daniel Crabbe