Reputation: 540
I am using gallerific http://www.twospy.com/galleriffic/ to display thumbnails and large images when a user clicks a thumbnail. You can see it in action here http://kimmelkids.com/kimmelkids/gallery/view-gallery/
My question is I know jquery can grab variables from the url and that is how gallerific changes images. But when I put in the url http://kimmelkids.com/kimmelkids/gallery/view-gallery/#leaf into the address bar it should go to the image in the gallery but it doesn't.
Is there any way to have gallerific pull up the image based on the url enter into the address bar?
Upvotes: 0
Views: 849
Reputation: 478
Yes, window.location.hash
conveniently gives us the hashtag at the end of the URL. You could try this:
$(document).ready(function() {
// Which anchor is being used?
switch(window.location.hash) {
case "#leaf":
// do something to show leaf
break;
case "#carrot":
// do something to show carrot
break;
}
});
..or if you want you could assign a specific anchor to each image (like through id='leaf' or something) and use some jQuery to just act on any image with the ID of window.location.hash
.
Upvotes: 2