Javascript acces from krpano

  • Hi,
    I want to set a variable of a javascript file from the xml file when i click on a hotspot.

    But i dont know how to do this *sad*

    Edit :
    Here is a part of my code :

    Edited once, last by ghostEvil (April 25, 2014 at 4:27 PM).

  • Hi,

    write a custom Javascript function at global scope that will do what you need (like setting some custom Javascript variables) and then call this function by using the js() action and pass the settings you want to set to it.

    E.g. to pass the current hlookat/vlookat values:

    xml:

    Code
    onclick="js( yourfunction(get(view.hlookat), get(view.vlookat)) );"

    js:

    Code
    function yourfunction(hlookat, vlookat)
    {
     alert("hlookat="+hlookat+" vlookat="+vlookat);
    }

    Best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!