138mph
Posts: 2
Joined: Mon Mar 02, 2015 12:36 pm

updating currently viewed image

I want to change the image currently viewed when a given key is hit.
I have tried:

Code: Select all

hs.onKeyDown = function (sender, e) {
   var exp = hs.getExpander();
   if( e.keyCode == 9 ){
		var EISarg = exp.src;
		var flopped = EISarg.search(/;flop=1/);
		if ( flopped > 0 ){
			EISarg = exp.src.substr(0, flopped);
			exp.src = EISarg;
		} else {
			var nologging = EISarg.search(/;nologging=1/);
			if( nologging > 0 ){
				EISarg = exp.src + ";flop=1";
			} else{
				EISarg = exp.src + ";nologging=1;flop=1";
			}
			exp.src = EISarg;
		}
	   return false;
   }
   return true;
}
I have used console writes to show that exp.src gets updated correctly, and when I click on the updated location shown in the console window the updated image is displayed.

However, the image being shown by highslide does not change, so clearly exp.src in my function is not the same as the browser's image.src.

Anyone got any ideas?
Thanks
Hugh
User avatar
RoadRash
Posts: 8249
Joined: Tue Jul 15, 2008 6:43 pm
Location: Fredrikstad, Norway
Contact: Website

Re: updating currently viewed image

Have you tried exp.content.src instead of scr?
http://jsfiddle.net/roadrash/pjw6m8wo/
Hilde
Highslide Support Team

Overview of my Highslide sample pages: RoadRash.no
138mph
Posts: 2
Joined: Mon Mar 02, 2015 12:36 pm

Re: updating currently viewed image

RoadRash wrote:Have you tried exp.content.src instead of scr?
http://jsfiddle.net/roadrash/pjw6m8wo/
That's it, .. many thanks :D

Regards
Hugh

Return to “Highslide JS Usage”