Width/high ratio based document/layouts

you may try this in your documents head:

<script>

function layoutRequest(hypeDocument, element, event) {

var width = window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
var height = window.innerHeight || (window.document.documentElement.clientHeight || window.document.body.clientHeight);
var ratio = width/height;

if(ratio >= (4/3)){
return 'Landscape';
}else{
return 'Portrait';
}
}


  if("HYPE_eventListeners" in window === false) {
window.HYPE_eventListeners = Array();
  }
  window.HYPE_eventListeners.push({"type":"HypeLayoutRequest", "callback":layoutRequest});
</script>
5 Likes