[jQuery] Cycle plugin: problem showing slide titles in pager (using pagerAnchorBuilder function)

2009-08-20 Thread lumpysimon

Hi

This question has been asked several times in various places online,
but the solution that's usually given isn't working for me.

I want to show the slide titles (rather than just numbers) in the
pager, so am calling it like this:

jQuery(document).ready(function() {
jQuery('#cycle-pics').cycle({
speed:1000,
timeout:3000,
next:'#next',
prev:'#prev',
pager:'#cycle-numbers',
pagerAnchorBuilder: function(idx, slide) {
return ''+(idx+1)+' '+ slide.title +'';
}
});

jQuery('#pause').click(function() {
jQuery('#cycle-pics').cycle('pause');
});

jQuery('#play').click(function() {
jQuery('#cycle-pics').cycle('resume', true);
});

});

The pagerAnchorBuilder function is correctly showing the slide
numbers, but not the titles.

Does anyone have any suggestions why this code isn't working? (I'm
using jQuery 1.3.2 and Cycle 2.71).

Thanks!


[jQuery] Re: Cycle plugin: problem showing slide titles in pager (using pagerAnchorBuilder function)

2009-08-28 Thread lumpysimon

Hi Mike

Thank you very much for your suggestion, but that's not working either
I'm afraid - I still end up with just a blank space where I'd like the
title to appear.

(I also noticed that your method seems to strip the closing tag from
the #cycle-numbers div too, although I can't for the life of me work
out why it would do that!)

Cheers
Simon


On Aug 26, 8:20 pm, Mike Alsup  wrote:
> > This question has been asked several times in various places online,
> > but the solution that's usually given isn't working for me.
>
> > I want to show the slide titles (rather than just numbers) in the
> > pager, so am calling it like this:
>
> > jQuery(document).ready(function() {
> >         jQuery('#cycle-pics').cycle({
> >                 speed:1000,
> >                 timeout:3000,
> >                 next:'#next',
> >                 prev:'#prev',
> >                 pager:'#cycle-numbers',
> >                 pagerAnchorBuilder: function(idx, slide) {
> >                         return ''+(idx+1)+' '+ slide.title 
> > +'';
> >                 }
> >         });
> > });
>
> > The pagerAnchorBuilder function is correctly showing the slide
> > numbers, but not the titles.
>
> Try this:
>
> pagerAnchorBuilder: function(idx, slide) {
>     var txt = '' + (idx+1) + ' ' + $(slide).attr('title');
>     return ''+ text +'';
>
> }