I am using JS to proportionally resize my document to the width of the screen. For some reason it doesn’t work when the height is bigger than the width. The JS was created by @h_classen
This works on its own, but when you have more than one hype documents on a page they interfere with each other, and at least one of them becomes significantly smaller or disappears into its hidden overflow.
i simplyfied the sceneselector in the example above, but taking the sceneselector from hypeextensions it should also work for multiple documents with multiple layouts … hope so
there may be custom circumstances where it won’t work …
hypeDocument.currentSceneElement = function(){
return document.querySelector('#'+this.documentId()+' > .HYPE_scene[style*="block"]');
}
const yourHeight = 600, yourWidth = 400;
positioning();
window.addEventListener('resize', positioning)
function positioning(){
var width = window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
var height = Math.floor((width*yourHeight)/yourWidth);
var scene = hypeDocument.currentSceneElement();
scene.style.height = height + 'px';
document.getElementById(hypeDocument.documentId()).style.height = height + 'px';
hypeDocument.relayoutIfNecessary();
}