Javascript must be activated for this page!
NOTE: This page is from an older version, see the latest version
here .
To get access to krpano from Javascript the
krpano Javascript-Interface object
will be required.
This object can be get either
by using the onready callback-function of
the embedding script (the recommended way)
or by using the Javascript call:
document.getElementById(id)
The id parameter is the unique id of the viewer
(which is "krpanoSWFObject" by default) and can be also set
in the embedding script .
The interface object provides these Javascript functions:
set(variable,value) - set the given krpano variable to the given value.
get(variable) - return the value of the given krpano variable.
call(action) - call and execute any krpano action code .
spheretoscreen(h,v) - directly call the spheretoscreen action.
screentosphere(x,y) - directly call the screentosphere action.
The spheretoscreen / screentosphere functions will return an object with x, y properties.
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/" .