is it possible in hype to place a text field, which is fitting to height, depending how much text it is used,
like in html <div>test</div>?
i get always fixed height or scrollable text. also if i use innerHTML <div>test</div>
it is set to hypes defined textfield-height.
the reason is, i get text-data from a database loading into a hype textfield.
so sometimes i get more, sometimes less text. therefore the textfield should be flexible in it´s height.
Is there any chance this feature gets supported by Hype without loading a 277kB of a jQuerry library? Realistically this is not an option for majority of advertising creatives, which are limited in file weight.
Just run this hype function extension on you element
/**
* hypeDocument.setHeightToContent
* @param {HTMLDivElement} element to fix height on
*/
hypeDocument.setHeightToContent = function (elm) {
var overflow = elm.style.overflow;
elm.style.overflow = 'hidden';
hypeDocument.setElementProperty(elm, 'height', 0);
hypeDocument.setElementProperty(elm, 'height', elm.scrollHeight);
elm.style.overflow = overflow;
}
The following is an example file using this but also targeting the nodes with a dataset attribute. That’s totally optional. Example moved to next answer…
i have a problem with expanding textfield when i call text from json file. In my case flexible height doesn't work anymore. If i manualy insert custom text, than works normaly. Is there any solution?