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 7708769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:41:47+00:00 2026-06-01T00:41:47+00:00

I think I may be way in over my head here… I’m using a

  • 0

I think I may be way in over my head here…

I’m using a WP custom post type and attachments in conjunction with FancyBox to create a slideshow/gallery. Nothing fancy, I don’t think. You can see it here: http://photo.convoke.info/galleries/test-gallery/

Except, I want to be able to link to a particular image. So, in that particular gallery, there are two images. I’d like to be able to give someone a link like http://photo.convoke.info/galleries/test-gallery#1 and have it open up the gallery page with the first image already open in the lightbox. #2 for the second image, etc.

Is this possible?

It doesn’t have to be #1… could be any sort of identifier. I’m pretty noob at javascript/jQuery stuff, so please forgive me… I tried googling around but couldn’t find anything of use.

Thanks!

  • 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-06-01T00:41:48+00:00Added an answer on June 1, 2026 at 12:41 am

    Whelp, after a few weeks of mucking around, I finally figured it all out. I needed a few functions:

     $(document).ready(function() {
                   if (window.location.hash) { // if there is a hash
                           $.fancybox.open($('.fancybox'), {index : parseInt(location.hash.substring(1))});
                   }
           });
    

    This badboy checks for a hash, and opens the image corresponding to said hash using fancy box ONLY WHEN THE PAGE IS LOADED.

    function sethash(id)
    {  
       top.document.location.hash = id;
    }
    

    This little guy is called by the links to each image in the gallery markup. It sets tthe hash of the page equal to the index of whatever image you’ve clicked on.

    <a onclick="sethash('$count')>Image</a>
    

    This isn’t REAL code, but you get the idea. I have a variable called count that I use to index each image in the gallery. This number corresponds to the index of the image in the fancybox slideshow (i.e. it starts at 0 for the first image in the gallery)

    It was a lot of work, but it’s finally working (almost) perfectly. The last thing I’m going to try is to get the hash to change/update when you click on the previous/next arrows in fancybox. But frankly, if that doesn’t work, I don’t really care.

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

Sidebar

Related Questions

This isn't quite as straight forward as one may think. I'm using a plugin
I've found what I think may be a bug with Ivar and Objective-C runtime.
You may think this question is like this question asked on StackOverflow earlier. But
I think I may have a misunderstanding of <xsl:variable\> and <xsl:value-of\> so perhaps someone
I think I may have accidently disabled stylecop in my Visual Studio 2008 enviroment.
I think I may be a bit confused on the syntax of the Moq
I think we may have trouble with our existing project. For some reasons we
Do you think it may be OK for a person to have more than
Hopefully this question isn't as subjective as I think it may be. I have
Sometimes it's difficult to describe some of the things that us programmers may think

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.