![]() ![]() Wouldn’t it be nice if I could just specify in the HTML which elements I wanted to automatically resize? What would that look like? How could you design and implement such a solution? Some of my elements were being dynamically added and removed from the DOM at different points in time, so just passing in a couple elements when my script initialized wasn’t enough. Part of my problem was that I needed to be able to easily specify both which elements I wanted to resize and when I wanted them to resize. ![]() Simple-and a simple JS implementation these days is, well, kind of refreshing. from a single Node autosize( document. From the docs: // from a NodeList autosize( document. The implementation was simple: include the script on your page, query select the (s) on the page you want to automatically resize, and pass it to the autosize function. I was recently working on a side project and found myself wanting to automatically resize a (vertically) as content was input by the user.Īs I began looking into how to achieve this functionality, I found a great stand-alone script called autosize that’ll do this for you automatically with minimal fuss.
0 Comments
Leave a Reply. |