How to detect DIV's dimension changed?

后端 未结 25 2861
抹茶落季
抹茶落季 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:49

    Using Clay.js (https://github.com/zzarcon/clay) it's quite simple to detect changes on element size:

    var el = new Clay('.element');
    
    el.on('resize', function(size) {
        console.log(size.height, size.width);
    });
    

提交回复
热议问题