krpano Javascript Interface
During embedding the krpano viewer into the HTML page an Identification Name (
ID) will be specified.
The default ID is
"krpanoSWFObject".
Link: See here for the
id parameter:
Embedding into HTML.
After embedding a HTML DOM Element with that ID will be created.
This object can be get via the normal Javascript
document.getElementById(id) function.
The krpano viewer exports these 3 Javascript functions to that object:
- set(variable,value) - Sets any krpano variable to the given value.
- get(variable) - Returns the value of any krpano variable.
- call(action) - Calls and executes krpano action code.
Get the krpano HTML DOM Element:
var krpano = document.getElementById("krpanoSWFObject");
Get and set a variable:
var fov = Number( krpano.get("view.fov") );
fov += 10.0;
krpano.set("view.fov", fov);
Call a krpano action, e.g. to load an other pano.
krpano.call("loadpano('pano2.xml',null,MERGE,BLEND(1));");
These examples were also included in the krpano viewer
download package
in the folder
"examples/javascript-interface/".