Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6874467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:11:55+00:00 2026-05-27T04:11:55+00:00

Trying to get this custom pager to work for jQuery Cycle. I want the

  • 0

Trying to get this custom pager to work for jQuery Cycle.

I want the pagerAnchorBuilder to return a list item every 5 images so later on I can turn the pager into it’s own cycle.

Here’s the code:

  pagerAnchorBuilder: function(idx,slide){
        var $slideCount = $('#ul-homecycle > li').length; 
            if ((idx==0) || (idx%5 === 0)){
                return '<li><a href="javascript:setSlide('+ idx +')" class="transhover"><img src="../images/home/thumb_carousel' + idx + '.jpg" width="183" height="72" /></a></li>';
            }
            else{ 
                return '<a href="javascript:setSlide('+ idx +')" class="transhover"><img src="../images/home/thumb_carousel' + idx + '.jpg" width="183" height="72" /></a>';

            }
    }

So in the end I want Cycle to return this:

<ul>
<li>
<a href="javascript:void(0);">derp</a>
<a href="javascript:void(0);">derp</a>
<a href="javascript:void(0);">derp</a>
<a href="javascript:void(0);">derp</a>
<a href="javascript:void(0);">derp</a>
</li>
<li>
<a href="javascript:void(0);">derp</a>
<a href="javascript:void(0);">derp</a>
<a href="javascript:void(0);">derp</a>
<a href="javascript:void(0);">derp</a>
<a href="javascript:void(0);">derp</a>
</li>
</ul>

Please disregard the setSlide(#) and the class values from the HTML string return in the JS, I have that under control. I can’t figure this out even after 2 hours of searching.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:11:56+00:00Added an answer on May 27, 2026 at 4:11 am

    I ended up figuring it out. Here’s the modified code, commented for your convenience:

    function cycles(){
        //Activate main slide with proper pager/carousel container.
        $('#ul-homecycle').after('<div id="homecycle-carousel-container"><a href="javascript:void(0);" id="btn-homecycle-prev" class="transhover"></a><a href="javascript:void(0);" id="btn-homecycle-next" class="transhover"></a><ul id="homecycle-carousel">').cycle({
            timeout: 7000,
            speed: 500,
            sync: true,
            fx: 'fade',
            fit: 0,
            startingSlide: 2,
            activePagerClass:'active',
            slideResize: 0,
            pager:  '#homecycle-carousel',
            pagerAnchorBuilder: function(idx,slide){
                return '<a href="javascript:setSlide('+ idx +')" class="transhover"><img src="../images/home/thumb_carousel' + idx + '.jpg" width="183" height="72" /></a>';
            },
            // Build pager that automagically hightlights updated pager thumb and also continue to next pager slide if the next thumb isn't visible
            updateActivePagerLink: function(pager, activeIndex) { 
                $(pager).find('a').not(':eq('+activeIndex+')').removeClass('active').children('img').fadeTo(200,.5)
                $(pager).find('a:eq('+activeIndex+')').addClass('active').children('img').fadeTo(200, 1); 
    
                //If next slide in carousel is hidden then go to next carousel slide
                if ($(pager).find('a:eq('+activeIndex+')').parent('li').css('display') == "none"){
                    $('#homecycle-carousel').cycle('next');
                }
            }
        });
            //Before building the carousel wrap an Li around every 5 thumbs    
            $('#homecycle-carousel > a').each(function(i) {
               var a = $('#homecycle-carousel > a');
                for( var i = 0; i < a.length; i+=5 ) {
                    a.slice(i, i+5).wrapAll('<li></li>');
                }
            });
            //Now that we have Lis wrapped around every 5 thumbs, initiate new cycle    
            $('#homecycle-carousel').cycle({
                easing: 'easeOutSine',
                prev: '#btn-homecycle-prev',
                next: '#btn-homecycle-next',
                slideExpr: 'li',
                activePagerClass:'active',
                timeout:0,
                speed: 500,
                fx: 'scrollHorz'
            });
            //Artifically activate new thumb 
            $('#homecycle-carousel li a').click(function(){
            if(!$(this).hasClass('active')){
                $('#homecycle-carousel li a').not(this).removeClass('active').children('img').fadeTo(200,.5);
                $(this).addClass('active').children('img').fadeTo(200,1);
            }
            });
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to get this to work, with no luck: [DataMember] public Type ParameterType {
I'm trying to get this css layout to work with IE7 and I'm a
I've been trying to get this module to work and no matter what I've
I am trying to get this awesome JQuery plugin working with SQL Server. I
I'm trying to get this simple program to work on windows, but it crashes:
I'm trying to get this to work, in a Wicket renderHead-method the parameter IHeaderResponse
I'm trying to get custom relationship names to work in Mongo. A collage is
I am trying to get the jquery plugins timpickr and multidatespicker to work on
Im trying to get this working but for some reason it's just not right.
Been trying to get this up and running for a while now. Basically i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.