iFrame close itself?
I guess this is harder than it should be. The issue is that your skin is setting the visibility of the 'web_page' element, and I would need to set that variable from within the logic in my iFrame website.
I am guessing this is how we do it:
I am guessing this is how we do it:
Code: Select all
onCloseClicked: function() {
var pano = window.parent.document.pano; // how do i get this pano object from the dom?
pano.setVariableValue('vis_website', false);
},
As expected, it doesn't recognise `pano` from my code. Anyone know how to reference this API object from iFrame source?
I also doubt whether setting the variable like so is enough to immediately hide the iframe. Would you need to also trigger an update event?
I also doubt whether setting the variable like so
Code: Select all
pano.setVariableValue('vis_website', false);
It was as easy as this ...
Just be aware that the variable name is set in the skin I am using.
Code: Select all
onCloseClicked: function() {
parent.pano.setVariableValue('vis_website', false);
},
Hi,
Any link where we can see this in action?
Tony
Any link where we can see this in action?
Tony
Tony Redhead | Panoramic Photographer | mobile: +61438501002 | website: https://tonyredhead.com - https://redsquare.com | Pano2VR Tutorials: https://tonyredhead.com/pano2vr | instagram: https://www.instagram.com/tonyredhead/
I'm unable to send a link to this project yet, but it is live in July, so soon.
To close an iframe from within the iframe content you need to have full access to the content, and I believe it also needs to be in the same domain.
The code I posted ...
... uses the javascript API to set the visibility of the iframe element. Depending on how you are showing and hiding your iframe in the skin, you may have a variable for turning the visibility on and off. This is the variable in the code.
In my website i have a button and a javascript function called but be sure that the scope in which this function is called is correct for .
There may be a more global way to refer to the pano object. I'm not sure.
To close an iframe from within the iframe content you need to have full access to the content, and I believe it also needs to be in the same domain.
The code I posted ...
Code: Select all
onCloseClicked: function() {
parent.pano.setVariableValue('vis_website', false);
},
Code: Select all
vis_website
In my website i have a button and a javascript function called
Code: Select all
onCloseClicked
Code: Select all
parent.pano
There may be a more global way to refer to the pano object. I'm not sure.