Wedge
Public area => The Pub => Off-topic => Topic started 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:
// 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.
-
Can't you use this?
$(function()
{
if (window.location.hash.length > 0)
gotoImage(windows.location.hash);
});
-
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..
-
Dragooon? :whistle:
-
Oops, should be window not windows
$(function()
{
if (window.location.hash.length > 0)
$.galleriffic.gotoImage(window.location.hash);
});
-
:cool: :cool: :cool: :cool: