Question

I would like to call a javascript function from with a Panotour Pro virtual tour - from a hotspot, I cant find any examples of how to do so.

Ideally a lightbox / modal window of some type?

It says you can simple call a JS function from a hotpot using the UI without quotes as in helloWorld(this is a test);

and add this JS function to the same page as tour. function hellworld(s) { alert(s); }

Nothing happens, I have Googled this for hours, no luck, any help, appreciated..

I am happy to have a hack at xml main/tour files to get this working, just don't know here to start...?

Was it helpful?

Solution

I have been playing with the JavaScript calls from PanoTour and it seems the tour must be uploaded to a web server before the javascript starts working as expected.

I added a couple of hotspots to a scene and added a JavaScript function call like this... LaunchColorBox(http://full-url-of-file.com/,title);

and then added a javascript function to page containing tour with same structure function LaunchColorbox(url, caption){ $.colorbox({href:url, title:caption, width:"60%", height:"55%",opacity: 0.3, iframe:true});
}

See following page source for further details of how I call/integration: view-source:http://www.panoramus.co.uk/panos/arrowsmith/gallery/

Hope this helps, as not well documented.

OTHER TIPS

This may help, shows the basic format for calling JS from PTP. http://www.autopano.net/wiki-en/action/view/Panotour_Pro_-_Hotspot_Properties_-_Link

Java Script Lets you call JavaScript functions from the tour. The function must be accessible in the HTML page containing the tour. Just write the call as if it was in a JavaScript code, but remove the quotes.

For example : “helloWorld(parameters*)”

You can use the following templates as parameters : %p : name of the current panorama %f : name of the XML file describing the current panorama %s : Fullscreen state when entering in the JS function

krapano uses js(helloWorld()) to call custom javascript functions

see: http://krpano.com/forum/wbb/index.php?page=Thread&threadID=998

Here are the relevant pieces of code.

first, the onstart item...

Source code 1

onstart="set(current_xml, marlin_creek.xml); js(show_name());

 ... this could be called from different areas...

The click me buttom references the same js function.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top