[jQuery] Re: Cycle Pluging next up text

2009-01-13 Thread amuhlou

I actually fiddled around with it a bit and I think I have it fixed.
I added in a couple more lines and it seems to find the right slide
name:

   else if (!fwd  index == 0)
$nextSlide = $slides.eq(opts.slideCount-1);

Unfortunately, I don't think I like how it works now!  It seems
strange that the upcoming slide changes depending on the direction
you're going in... so I may just make the next/previous buttons
disappear per your demo at http://www.malsup.com/jquery/cycle/after.html

Thanks again!


On Jan 12, 4:21 pm, amuhlou amysch...@gmail.com wrote:
 Thanks much, that just about does it! The only issue I've found is
 that $nextSlide becomes undefined if paging backwards.

 For example:http://static.spartaninternet.com/sandbox/

 If you click the back button to get to slide 1 it becomes undefined.

 ~amy

 On Jan 12, 3:56 pm, Mike Alsup mal...@gmail.com wrote:

              function onAfter(currSlideElement, nextSlideElement,
   options, forwardFlag) {
                   $('#main').html(this.alt);
             }});

   Ideally, in my onAfter callback I would like to have the upcoming
   image's alt text instead of the current one's.  Is this possible?

   Thanks!
   ~Amy

  Hmm, a bit tricky but this might get the job done:

  function onAfter(curr,next,opts,fwd) {
          var $slides = $(this).parent().children();
          var index = $slides.index(this);
          var $nextSlide;
          if (fwd  index == (opts.slideCount - 1))
                  $nextSlide = $slides.eq(0);
          else if (fwd)
                  $nextSlide = $slides.eq(index+1);
          else if (opts.slideCount == 0)
                  $nextSlide = $slides.eq(opts.slideCount-1);
          else
                  $nextSlide = $slidex.eq(index-1)

          $('#main').html($nextSlide.attr('alt'));

  }

  Disclaimer: this won't work if you're using the 'slideExpr' option.

  Mike




[jQuery] Re: Cycle Pluging next up text

2009-01-12 Thread Mike Alsup

            function onAfter(currSlideElement, nextSlideElement,
 options, forwardFlag) {
                 $('#main').html(this.alt);
           }});

 Ideally, in my onAfter callback I would like to have the upcoming
 image's alt text instead of the current one's.  Is this possible?

 Thanks!
 ~Amy


Hmm, a bit tricky but this might get the job done:

function onAfter(curr,next,opts,fwd) {
var $slides = $(this).parent().children();
var index = $slides.index(this);
var $nextSlide;
if (fwd  index == (opts.slideCount - 1))
$nextSlide = $slides.eq(0);
else if (fwd)
$nextSlide = $slides.eq(index+1);
else if (opts.slideCount == 0)
$nextSlide = $slides.eq(opts.slideCount-1);
else
$nextSlide = $slidex.eq(index-1)

$('#main').html($nextSlide.attr('alt'));
}

Disclaimer: this won't work if you're using the 'slideExpr' option.

Mike



[jQuery] Re: Cycle Pluging next up text

2009-01-12 Thread amuhlou

Thanks much, that just about does it! The only issue I've found is
that $nextSlide becomes undefined if paging backwards.

For example: http://static.spartaninternet.com/sandbox/

If you click the back button to get to slide 1 it becomes undefined.


~amy

On Jan 12, 3:56 pm, Mike Alsup mal...@gmail.com wrote:
             function onAfter(currSlideElement, nextSlideElement,
  options, forwardFlag) {
                  $('#main').html(this.alt);
            }});

  Ideally, in my onAfter callback I would like to have the upcoming
  image's alt text instead of the current one's.  Is this possible?

  Thanks!
  ~Amy

 Hmm, a bit tricky but this might get the job done:

 function onAfter(curr,next,opts,fwd) {
         var $slides = $(this).parent().children();
         var index = $slides.index(this);
         var $nextSlide;
         if (fwd  index == (opts.slideCount - 1))
                 $nextSlide = $slides.eq(0);
         else if (fwd)
                 $nextSlide = $slides.eq(index+1);
         else if (opts.slideCount == 0)
                 $nextSlide = $slides.eq(opts.slideCount-1);
         else
                 $nextSlide = $slidex.eq(index-1)

         $('#main').html($nextSlide.attr('alt'));

 }

 Disclaimer: this won't work if you're using the 'slideExpr' option.

 Mike