Hi Mike,

While experimenting with the pager functionality of the cycle plugin, I noticed that the first anchor wasn't getting the "activeSlide" class on initial load. I did some testing and fixed it by modifying the function to this:

function buildPager(els, opts) {
   var $p = $(opts.pager);
   $.each(els, function(i,o) {
       var $a = (typeof opts.pagerAnchorBuilder == 'function')
           ? $(opts.pagerAnchorBuilder(i,o))
           : $('<a href="#">'+(i+1)+'</a>');
       $a.appendTo($p).bind('click',function() {
           opts.nextSlide = i;
           var p = els[0].parentNode, timeout = p.cycleTimeout;
           if (timeout) {
               clearTimeout(timeout);
               p.cycleTimeout = 0;
} if (typeof opts.pagerClick == 'function')
               opts.pagerClick(opts.nextSlide, els[opts.nextSlide]);
           go(els,opts,1,!opts.rev);
           return false;
       });
   });
   if (opts.pager)
       $(opts.pager).find('a').filter('a:eq(0)').addClass('activeSlide');
};

I am not sure if this is the best approach, but now it works as expected. Thanks again for your hard work on this awesome plug-in. It is very versatile.

-Marshall

Reply via email to