1 (edited by Davy 2020-04-04 13:16:28)

Topic: How can I use the hash? [SOLVED]

As soon as I change photos, I want to request the hash from the url to use for additional information about the photo, for example, a translation of the text that is in the photo. See https://davidbrouwer.nl/FotoserieHTML5. … ;pics=18#1 click to photo 3 (#3) then move on to 4 and you'll see the text on the 5th tab change on the left. If you go back to 3 and you click on the thumbnail then the correct hash is read in. Does anyone know how to get the right hash?

Re: How can I use the hash? [SOLVED]

If you just need to determine the index of the image currently being displayed, then you can do so using the Juicebox-Pro API (specifically the onImageChange() event).
Here's an example which displays an alert box each time a new image is selected displaying the current image index. (You can use the value (e.id) as you like.)

//create a gallery instance
var jb = new juicebox({
    containerid:'juicebox-container'
});
//then set up an event listener
jb.onImageChange = function(e){
    alert("Image changed. Image index: " + e.id);
};

If you really want to fetch the hash from the URL, then try the following:

//create a gallery instance
var jb = new juicebox({
    containerid:'juicebox-container'
});
//then set up an event listener
jb.onImageChange = function(e){
    alert("Image changed. Image index: " + window.location.hash);
};

I hope this helps.

Re: How can I use the hash? [SOLVED]

Thanks, I saw the API and I found the way to do with onImageChange

Re: How can I use the hash? [SOLVED]

That's great! Thank you for letting me know.