jquery实现元素高度变化页面变化
试了几种方法包括有资料说的h5新特性,都没能满足我的需求。我的需求如下:
元素高度是动态可变的,比如可拖动teatarea元素
最后用到了指针监听事件解决了
$(document).mousemove(function(e){
//这一块处理页面高度
});
示例:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
$(document).mousemove(function(e){ var height=""; $($("body div").children()).each(function(index,item){ height+=$(item).height(); }); $('#replaceContent', parent.document).height(height); });
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<body> <div> <form id="form"> <table> <tr><td><textarea rows="" cols=""></textarea></td></tr> </table> </form> </div> </body>
定义和用法
当鼠标指针在指定的元素中移动时,就会发生 mousemove 事件。
本文来自博客园,作者:每天都要学一点,欢迎讨论和转载,转载请注明原文链接:https://www.cnblogs.com/yanan7890/p/9875039.html