Get Info In Real-time as Browser is resized

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?

https://www.w3schools.com/jsref/event_onresize.asp
https://www.w3schools.com/jsref/prop_win_innerheight.asp

1 Like

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);
}
1 Like

Thank you Daniel! That worked perfectly.