Wedge

Public area => The Pub => Off-topic => Topic started by: MultiformeIngegno on January 2nd, 2013, 07:11 PM

Title: Linking to a specific item on a jQuery portfolio-style gallery (Galleriffic)
Post by: MultiformeIngegno on January 2nd, 2013, 07:11 PM
Need a little help with this(http://lorenzoraffio.com/test.php) jQuery portfolio-style gallery.
As you can see there is a main image with a related caption and other small images below. If you click one of them the main image/caption changes to display the one you selected. If you notice when you hover the pointer on any of the images below the big one you get a link like test.php/#image3 or test.php/#image6.

I'm looking for a way to have that if you visit test.php/#image3 (directly, not through the onClick event) you have the #image3 as main image (so without having to click on it). The same for test.php/#image4 / #image5, etc.

The gallery uses the Galleriffic plugin for jQuery...

This is a small piece of the code:
Code: [Select]
// Global function that looks up an image by its hash and displays the image.
// Returns false when an image is not found for the specified hash.
// @param {String} hash This is the unique hash value assigned to an image.
gotoImage: function(hash) {
var imageData = $.galleriffic.getImage(hash);
if (!imageData)
return false;

var gallery = imageData.gallery;
gallery.gotoImage(imageData);

return true;
},

I think I need a script that adds onLoad the same even that happens onClick, using window.location.hash; to match the part after the # with the image.
Title: Re: Linking to a specific item on a jQuery portfolio-style gallery (Galleriffic)
Post by: Dragooon on January 2nd, 2013, 07:36 PM
Can't you use this?

Code: [Select]
$(function()
{
    if (window.location.hash.length > 0)
        gotoImage(windows.location.hash);
});
Title: Re: Linking to a specific item on a jQuery portfolio-style gallery (Galleriffic)
Post by: MultiformeIngegno on January 2nd, 2013, 10:50 PM
Thanks for the reply! :)
I added it at the end of the page but if I visit http://lorenzoraffio.com/test.php#image7 it stills display the first image/caption in the big div..
Title: Re: Linking to a specific item on a jQuery portfolio-style gallery (Galleriffic)
Post by: MultiformeIngegno on January 3rd, 2013, 08:07 PM
Dragooon? :whistle:
Title: Re: Linking to a specific item on a jQuery portfolio-style gallery (Galleriffic)
Post by: Dragooon on January 3rd, 2013, 08:18 PM
Oops, should be window not windows
Code: [Select]
$(function()
{
    if (window.location.hash.length > 0)
        $.galleriffic.gotoImage(window.location.hash);
});
Title: Re: Linking to a specific item on a jQuery portfolio-style gallery (Galleriffic)
Post by: MultiformeIngegno on January 3rd, 2013, 08:37 PM
:cool: :cool: :cool: :cool: