Javascript image change event.

Posted by user430515 
Javascript image change event.
August 18, 2011 05:08PM
I recently asked Jumpeye if it was possible to detect when the Javascript slideshow changed image and I was told that it wasn't possible. After playing around with Firebug I managed to find the elements added to the DOM. So for anybody interested in detecting the change just add this Javascript code to your page (it's not pretty but it works):

var currentImg = "";

(function domSniffer(){

if(document.getElementById("slideshowBoxEmbedCanvasContainer1_template_img")){

if(document.getElementById("slideshowBoxEmbedCanvasContainer1_template_img").src != currentImg){

// The image has been changed
// Do Stuff...

}


}

window.setTimeout(domSniffer, 0500);
})();
Re: Javascript image change event.
August 24, 2011 01:16PM
Actually we said that this is possible only for the flash version. When we said that getting to know when an image is change is only possible for the flash version, we meant that we didn't add a change event that you can use. However if you are able and skilled enough to add your own separate code that allows you to track and see when an image is changed, that's good for you.
PS The code from above only works for some templates that has that id.
Re: Javascript image change event.
August 26, 2011 07:46AM
Thus why it says 'Javascript' in the thread title. From the templates I tested, every first slideshow is added with that ID, then the next is 'slideshowBoxEmbedCanvasContainer2_template_img' and so on and so forth.

I just thought it might help somebody who had the same problem as me.
Sorry, only registered users may post in this forum.

Click here to login