Get Info In Real-time as Browser is resized

(steve) #1

I need to be able to get the width of the browser and also query the size of a hype control as it gets resized while the browser is being resized. Just using breakpoints and layouts won’t do it for me. Is there a way to do this with Javascript?



You can run this function ‘on scene load’ and it will re-run each time the browser is resized:

window.onresize = function(event) {
// get the width of the enclosing Div for the Hype element
var currentWidth = hypeDocument.getElementById(hypeDocument.documentId()).offsetWidth;
alert("the current width of the Hype container is:" + currentWidth);

(steve) #4

Thank you Daniel! That worked perfectly.