How to detect DIV's dimension changed?

后端 未结 25 2379
抹茶落季
抹茶落季 2020-11-22 06:14

I\'ve the following sample html, there is a DIV which has 100% width. It contains some elements. While performing windows re-sizing, the inner elements may be re-positioned,

25条回答
  •  孤独总比滥情好
    2020-11-22 06:53

    i thought it couldn't be done but then i thought about it, you can manually resize a div via style="resize: both;" in order to do that you ave to click on it so added an onclick function to check element's height and width and it worked. With only 5 lines of pure javascript (sure it could be even shorter) http://codepen.io/anon/pen/eNyyVN

    WxH

    This my example demonstrates how to run a resize check on click for resizable div.

    Try to resize the box.

提交回复
热议问题