It is currently Wed Nov 26, 2014 10:11 pm Advanced search

Get id of actually displayed picture during slideshow

Technical support, bug reports, feature requests and more.

Get id of actually displayed picture during slideshow

Postby ambipur » Fri Feb 03, 2012 8:15 am

Hi everybody,

I would like to know if it is possible to cath the event when for example each 50th picture is displayed during slideshow? Or is it possible to get the id of the actually displayed picture? I would like to trigger a javascript function when each 50th picture is displayed during the slideshow. Thank you very much!
ambipur
 
Posts: 25
Joined: Fri Dec 31, 2010 3:31 pm

Re: Get id of actually displayed picture during slideshow

Postby RoadRash » Sat Feb 04, 2012 11:13 pm

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 [hilight]id="img2"[/hilight] 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() {
    [hilight]if (this.a.id == 'img2')[/hilight] {
        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 )
Hilde
Highslide Support Team

Overview of my Highslide sample pages: RoadRash.no
User avatar
RoadRash
 
Posts: 8228
Joined: Tue Jul 15, 2008 8:43 pm
Location: Fredrikstad, Norway

Re: Get id of actually displayed picture during slideshow

Postby ambipur » Wed Feb 22, 2012 12:54 am

Hi Roadrash,

thanks for your help, it works fine!
ambipur
 
Posts: 25
Joined: Fri Dec 31, 2010 3:31 pm


Return to Highslide JS Usage

Who is online

Users browsing this forum: Bing [Bot] and 5 guests