You are not logged in.

1

Friday, April 1st 2011, 2:19am

wrapping js in function

I just bought and set up this html5 pano viewer. Loading panos onload
of the browser does not suit my needs. I need it to launch based on a
javascript event (click). So I took the demo, wrapped the js in a
function and hooked up a link to that function, so I could trigger it
with the click. Well that doesn't work for me. This is what I did at
the end of the file:


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
	<script>
	function test1(){
		var viewer = createPanoViewer({swf:"krpano.swf", xml:"includes/tour.xml", target:"panocontent"});
		
		if ( viewer.isHTML5possible() )

		{
			viewer.useHTML5("always");
			viewer.embed();
		}
		else
		{
			// show error message
			document.getElementById("nonhtml5infos").style.display = "inline";

		}
	}
	//test1();
	</script>
	<a href="#" onclick="test1();return false;">load pano</a>



VERY simple! Anyway, you can view it in action here:

http://archive.cyark.org/iphone/krpano_html5only.html

What's wrong? Why isn't this working for me? I just need to wrap the calls in a function, and then hook up that function to some other js event. Any help would be greatly appreciated.

2

Friday, April 1st 2011, 9:33am

Can somebody please help me or point me to a tutorial that does what I am requesting? Basically, I want a list of links where each one launches a different pano. I know there is navigation abilities within the xml spec, but I need to use javascript. And I can't use a page reload. Any thoughts?

3

Monday, April 4th 2011, 8:32pm

Hi,

you would need the latest 1.0.8.14 pre-release from here:
http://krpano.com/download/beta/#2011-04-04

and you would need to use instead of the swfkrpano.js file a .js file with the krpanoiphone license embedded (e.g. generated by the MAKE PANO droplets),

or to include all .js files manually in the html file in the that order:

Source code

1
2
3
<script src="swfkrpano.js"></script>
<script src="krpanoiphone.license.js"></script>
<script src="krpanoiphone.js"></script>


then the dynamic embedded will work,
have also a look into the "iphone-ipad-simulator.html" from the pre-release package,

best regards,
Klaus