Action to change hotspot URL based on JS variable

  • Hi,

    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.

  • Something like this?

    KRPano hotspot (xml file)

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

    Javascript:

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

    You have to initiate krpano object before start using javascript interface (https://krpano.com/docu/js/#usage)

  • "Works like a charm.

    Thanks again for your help."

    Sorry I spoke too soon.

    The krpano.call 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.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!