Jump to content

Link to specific state in javascript gallery


cerstrand_mace

Recommended Posts

Hi!My question is kind of simple, but I realize that the solution might be kind of complicated:Is there a way of linking to a specific state in a javascript gallery? I want to be able to link to each image in my gallery from another page on the site. When you click the link you shall be directed to the page with the gallery and the gallery should show the desired image, in it's general place in the javascript.Is there any solution for this? Here's the gallery:http://www.triwest.se/mattor_design.html /Carl

Link to comment
Share on other sites

Maybe somthing like this, Page with link

<a href="gal.htm?sowImage=filkename.png">Link to image</a>

page with gallery

<script>var gstring = window.location.split('#')[1];if (qstring == 'showimage') {filename = qstring.split('=')[1];if (filename != undefind) {  //code show you image}}</script>

that makes it posible to detect, witch like used to go to the gallery, then you just use the same code at when you change pics. hope it helps

Link to comment
Share on other sites

The gallery would need to support something like that, even if you change it yourself to do that. There would need to be a way to save and load the state of the gallery, so that you can click a button or something to create a link to that state, and when the page loads it would need to read the state from the URL and have a way to rebuild the gallery to that state. So the state information needs to include everything that the gallery needs to know to reproduce the state, which may only be the filename of the image to show.

Link to comment
Share on other sites

hi. i do, know this is posible. http://www.twospy.co...xample-3.html#6 this link, wil go to one of Galleriffic's Exampel galleries, and show the image named 7 http://www.twospy.co...-3.html#bigleaf and this to the image named bigleaf.it uses the jQuery.History plugin. so with a little coding, it is posible. but to keap it simpel, wath i wil do on if it wash me, is to insert this in the head of the page.

<script>$(document).ready(function() {var imagename = window.location.split('#')[1];if (qstring != undefind) {$('a[href=#' + imagename + ']').click();}});</script>

iam not shure(sikker) if it wil work, becurce of somthing '[mod]More Human Than Human' asyncron rending of JavaScript, but i you can get it to run after the galleri is fully renderet

Edited by miela1
Link to comment
Share on other sites

hi. i do, know this is posible. http://www.twospy.co...xample-3.html#6 this link, wil go to one of Galleriffic's Exampel galleries, and show the image named 7 http://www.twospy.co...-3.html#bigleaf and this to the image named bigleaf.it uses the jQuery.History plugin. so with a little coding, it is posible. but to keap it simpel, wath i wil do on if it wash me, is to insert this in the head of the page.
<script>$(document).ready(function() {var imagename = window.location.split('#')[1];if (qstring != undefind) {$('a[href=#' + imagename + ']').click();}});</script>

iam not shure(sikker) if it wil work, becurce of somthing '[mod]More Human Than Human' asyncron rending of JavaScript, but i you can get it to run after the galleri is fully renderet

The history plugin worked well! Strange how I missed that function :)I didn't use your code-snippet though, just copied the one from Galleriffic.Thanks for the help!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...