Topic: link in caption to specific image in same gallery
Using Simple Viewer Pro 1.9, is it possible to add a link in an image caption that when clicked on, sends the viewer to another image in the same gallery?
You are not logged in. Please login or register.
SimpleViewer Forum → SimpleViewer-Pro v1 → link in caption to specific image in same gallery
Using Simple Viewer Pro 1.9, is it possible to add a link in an image caption that when clicked on, sends the viewer to another image in the same gallery?
In the link in the caption, you could use link to the same gallery's HTML index page and add query string, eg:
<caption><![CDATA[<a href="index.html?id=2">Click to go to image number 2</a>]]></caption>
Using JavaScript in the gallery's 'index.html' page, you could search for a query string named 'id' and use the value as the firstImageIndex option and pass it to SimpleViewer as a flashvar.
Your embedding code would look something like this:
<div id="flashcontent">SimpleViewer requires JavaScript and the Flash Player. <a href="http://www.macromedia.com/go/getflashplayer/">Get Flash.</a></div>
<script type="text/javascript">
var fii = 0;
if (location.search)
{
var qs = location.search, qa={}, re = new RegExp("([^?=&]+)(?:=([^&]*))?", "g"), qc = null, qi = 0;
while (qc = re.exec(qs))
{
qa[qc[1]] = qc[2];
}
qi = parseInt(qa["id"]);
if (!isNaN(qi) && qi>0)
{
fii = qi-1;
}
}
var fo = new SWFObject("viewer.swf", "viewer", "100%", "100%", "8", "#181818");
fo.addVariable("firstImageIndex", fii);
fo.write("flashcontent");
</script>
Please note that the code above compensates for the fact that firstImageIndex starts at 0 for the first image so in your query string, you can use 'index.html?id=2' for the second image.
Worked Great! Thanks
Your the BEST!!!!
SimpleViewer Forum → SimpleViewer-Pro v1 → link in caption to specific image in same gallery
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 5 official extensions. Copyright © 2003–2009 PunBB.