topical media & game development
mobile-query-three-vendor-threex-examples-threex.domevent-vendor-threex-threex.embedded.js / js
@namespace
var THREEx = THREEx || {};
THREEx.Embedded = THREEx.Embedded || {};
returns: {Boolean} return true if we are in a iframe, false otherwise
THREEx.Embedded.inIFrame = function()
{
return window != window.top ? true : false;
}
Prevent Arrows key event from going out of the iframe
THREEx.Embedded.shieldArrowKeys = function()
{
document.addEventListener('keydown', function(event){
// if it is keydown on a arrow, prevent default
if( event.keyCode >= 37 && event.keyCode <= 40 ){
event.preventDefault();
}
}, true);
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.