You are not logged in.


Tuesday, April 14th 2015, 11:09am

Action to change hotspot URL based on JS variable


Firstly thank you for this great combination of technology.

I am working on integration krpano into Articulate Storyline. I have everything setup and working as I need to between SL and krpano.

One important item from a UX point of view is to change the hotspot to a different graphic and make it visible based on JS variables.
I have an action in the pano.xml that fires a JS function in pano.html when a user clicks on a hotspot. This function gets and sets variables in SL>

Based on these variables I would like to change the url and alpha value of a given hotspot.

Can I access the JS variables from the pano.xml and have an action to change the URL and Alpha?

Please let me know if you need more information.



Posts: 277

Location: Kobyłka, Poland

Occupation: Virtual Tours - Spherical Panoramas - Krpano developer

  • Send private message


Tuesday, April 14th 2015, 12:41pm

Something like this?

KRPano hotspot (xml file)

Source code

<hotspot name="hs1" url="icon.jpg" alpha="0.5" ... onclick="js(changeHotspot(get(name)))"/>


Source code

function changeHotspot(hsname) {"set(hotspot[" + hsname + "].url, newImage.jpg);");"set(hotspot[" + hsname + "].alpha, 1);");

You have to initiate krpano object before start using javascript interface (


Tuesday, April 14th 2015, 1:35pm

Yes Panomaster, that is exactly what I am looking for.
I will implement and report back.

Thank you!. *smile*


Monday, April 20th 2015, 12:28pm

Works like a charm.

Thanks again for your help.


Monday, April 20th 2015, 4:25pm

"Works like a charm.

Thanks again for your help."

Sorry I spoke too soon.

The is not working from the javascript function in pano.html. The function breaks at this point.
I setup my file to use the code verbatim except for the url off course.

I can get everything to work from the pano xml but I need to store the state in my use, pano.html gets reloaded after a user views the content for a given hotspot and returns to the panorama. So I would like to make sure the hotspot shows the visited version of the image.

I am troubleshooting and trying alternatives.


Monday, April 20th 2015, 6:10pm

I missed the line about initiating in your post *whistling* :
You have to initiate krpano object before start using javascript interface (

working on this.


Tuesday, August 4th 2015, 11:37am

my code does not work,

Source code