You are not logged in.

1

Friday, November 6th 2009, 8:58pm

Close window

Hi, all

I want to close with a plugin button the window and leave krpano

have you a action for that

java ? or other

thanx

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

2

Friday, November 6th 2009, 11:01pm

Hi Job1,

Javascript has the close method to close windows: close(), self.close() or window.close()
It seems to not be so easy.... There is some security limitation when trying to close a window that has not be opened by a JavaScript ....
More info here: http://docs.sun.com/source/816-6408-10/window.htm#1201822

SAlut.

3

Saturday, November 7th 2009, 10:04am

Merci Michel

Thanx Michel

Mais j'y arrive pas !!

But I can't do anything !!
*cursing*

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

4

Sunday, November 8th 2009, 12:01am

Hi job.1,

It seems that to be able to close() a window, that window must have be opened by a JavaScript ... otherwise, the close() does not work for security reason. (references here )

So, you must first open that window using a JavaScript code... Here an example code (references here ):

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<html>
<head>
	<title>Open your krpano window</title>
</head>

<body>
<center>
<br><br><br>
<FORM NAME="myform">
<INPUT TYPE="button" NAME="Button1" VALUE="Open Sesame!"
   onClick="window.open ('http://Your_Krpano_Page_To_Be_Loaded.html', 'newWin')">
</FORM>
</center>
</body>

To be able to close the window, you can add into Your_Krpano_Page_To_Be_Loaded.html the following JavaScript code:

Source code

1
2
3
4
5
6
7
<script type="text/javascript">
// <![CDATA[
	
	function CloseMyWindow() { top.window.close(); }

// ]]>
</script>

And into your Krpano.xml something like a button to call the CloseMyWindow() function:

Source code

1
2
3
4
5
<plugin name="close" keep="true" style="buttonstyle"
	html="[p]close[/p]"
	align="bottom" x="120" y="75"
	onclick="js(CloseMyWindow();)"
	/>


I have tried, and for me it works...
Hope this can help. ( t'énerve pas ;-) )

SAlut.

5

Sunday, November 8th 2009, 10:04am

Super Michel

Je teste cette affaire, merci pour ton travail ;-)

I try this *thumbup* and come back here

6

Sunday, November 8th 2009, 10:49am

Great !!!!!!!! *thumbsup*

it's work

only a detail

Source code

1
onclick="js(CloseMyWindow());"


possible to put a image in place of button ?

7

Sunday, November 8th 2009, 11:12am

I got it

Source code

1
<IMG SRC="img.jpg" NAME="Pano"  ONCLICK="window.open ('XXXXXX.html', 'newWin')">


Michel merci encore, tu m'as enlevé une sacré épine du pied et du coup il me reste des cheveux *g*

8

Tuesday, October 26th 2010, 1:17pm

Hello, All.
I try this code in html:

Source code

1
2
3
4
5
<script type="text/javascript">
// <![CDATA[	
	function CloseMyWindow() { top.window.close(); }
// ]]>
</script>

And this in xml:

Source code

1
2
3
4
5
6
7
8
<plugin name="close" url="buttons/close.png" 
	align="righttop" edge="center" x="26" y="19" alpha="0" keep="true"
	onloaded="tween(alpha,get(btp),get(spl1));"
	onclick="js(CloseMyWindow();)"
onhover="showtext('%A0Close%A0',system2);"
	onover="tween(alpha,1,0.1);" 
	onout="tween(alpha,get(btp),get(spz),easeInQuad);" 
/>

My 'close' button work good in Opera >=10.10 and IE >= 7.
But it don't work in Firefox 3.6.10.
What could be the problem?

Posts: 32

Occupation: Photographer/Virtual Tour Producer

  • Send private message

9

Tuesday, February 7th 2012, 3:53pm

Hi Folks,

I have the following code set up. Idea is to have the mobile version of the tour open up in an overlay to fill the entire phone screen (100%x100%), with a button inside the KRPano window which will close that overlay. The same button will also stop the soundinterface.js at the same time.

krpano xml:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<action name="audio stop">
	stopsound(audiotrack);
	</action>	

<plugin name="close"
      	url="close.png"
   	   devices="mobile"
      	align="topright"
   	   edge="topright"
   	   x="15"
   	   y="15"
   	   keep="true"
   	   visible="true"
   	   alpha="1"
    	    onclick="document.getElementById('virtual-tour-02').style.display='none';document.getElementById('vt-02').style.display='none';action(audio  stop);"
      	/>


html:

Source code

1
2
3
4
5
<div id="virtual-tour-02" class="overlay-item" style="text-align:right;">
<div class="overlay-title" style="text-align:left;">Explore 720° Panorama</div>
<div class="overlay-close">
<a href="javascript:;" onclick="document.getElementById('virtual-tour-02').style.display='none';document.getElementById('vt-02').style.display='none';">
</div>



According to the client, the "close" button inside KRPano is not working at the moment, although the overlay closes successfully when it is closed from outside the KRPano window. I've got the hang of the KRPano xml but the integration with the HTML/JS code on the website itself is a real weakness of mine.

Any pointers/suggestions, as ever, are greatly appreciated.

Malcolm

Posts: 1,857

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

10

Tuesday, February 7th 2012, 4:26pm

Make a javascript function
http://www.w3schools.com/js/js_functions.asp
http://krpano.com/docu/actions/#js

Source code

1
2
3
4
5
6
7
8
<script type="text/javascript">
<!--//--><![CDATA[//><!--
function closeit {
document.getElementById('virtual-tour-02').style.display='none';
document.getElementById('vt-02').style.display='none';
}
//--><!]]>
</script>


onclick="js(closeit())"'

I'm guessing this is mobile flash only. Using a box this way for iphones would likely cause dpi issues.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour