Hi,
You can add id to the anchor for the 50th image and use the
onAfterExpand event to trigger a JavaScript function.
HMTL markup
- Code: Select all
<a id="img2" href="http://highslide.com/images/gallery2.jpg" class="highslide" onclick="return hs.expand(this)">
<img src="http://highslide.com/images/gallery2.thumb.jpg" alt="Highslide JS"
title="Click to enlarge" /></a>
JS code
- Code: Select all
hs.Expander.prototype.onAfterExpand = function() {
if (this.a.id == 'img2') {
alert('This is the second image in the gallery');
}
};
Note:
onAfterExpand requires highslide-full.js
Live demo:
http://jsfiddle.net/dRh9p/ (The second image triggers an alert. If someone moves backwards in the gallery after passing the second image they will of course trigger the alert once more… )