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

  • Home
  • SEARCH
  • 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 4027316
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:04:55+00:00 2026-05-20T11:04:55+00:00

I have a custom image gallery which populates a div with thumbnails, each contained

  • 0

I have a custom image gallery which populates a div with thumbnails, each contained in a fancybox group.

When you click one (it opens in fancybox) and you can press Prev/Next to cycle between images on the first “page”. To move between pages, you have to close fancybox and change pages then open a new thumbnail. This new set of photos is retrieved via ajax.

To show you exactly what I’m talking about,
http://www.speedcountry.com/mSpeed323/Mazda_MAZDASPEED3

How can I use fancybox to switch pages and load the next set of images?

  • 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-20T11:04:55+00:00Added an answer on May 20, 2026 at 11:04 am

    It doesn’t appear there are any internal methods in FancyBox, so you’ll have to modify the plugin. I took the liberty of making a minor change and posting a demo – in the demo, open any image in a FancyBox popup, then press Enter on the keyboard. It will load all of the images into the gallery and start from the first.

    Modified line 887, then insert a line before 892:

    $.fancybox.pos = function(pos, array) { // array parameter added
        if (busy) {
            return;
        }
    
        if (array) { currentArray = array; } // new line
    

    So, basically add “array” as a function parameter, then add the if (array)... line.

    To use it, just call the pos function while FancyBox is open. This is the code from the demo:

    // pos( index of image, jQuery object of gallery objects )
    $.fancybox.pos(0, $('#examples a[id]'));
    

    *Note: Initially I just used $('a[id]') and it included the image that was inside fancy box.


    Update: So like you said, you are loading in more images using ajax… I’m guessing you are just getting a list of image urls. Starting with a url, you will need to form and add these images to the page in a hidden area:

    <div id="ajax-loaded" style="display:none">
     <a href="#" title="image1 title"><img src="image1.jpg"></a>
     <a href="#" title="image2 title"><img src="image2.jpg"></a>
     ...
     <a href="#" title="imageN title"><img src="imageN.jpg"></a>
    </div>
    

    Then you can make an array of jquery objects $('#ajax-content img') to the $.fancybox.pos function as a second paramter, and start with the first image (the zero)

    // ajax complete, add images to gallery
    $.fancybox.pos( 0, $('#ajax-loaded a') );
    

    Update #2: I wrapped the above HTML in links and the jQuery selector after I found that it is necessary if you want to include an image caption.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a XML image gallery, which displays text in between each slide.
I have a custom built ajax [div] based dynamic dropdown. I have an [input]
I have a custom Image class that I am using to store individual image
I like to have a custom selected image when a user selects an item
I have a custom UITableView cell that sports an Image, and a headline. I
I have a custom UITableViewCell which acts as a check list. As the user
I have a custom view which is composed of a number of UIImageViews. These
I have custom coded several enterprise applications for mid to large organizations to use
I have custom errors configured in my web.config, but IIS 6.0 is returning the
Can you have custom client-side javascript Validation for standard ASP.NET Web Form Validators? For

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.