//获取当前IDV的高度
function getHeight(ele){
$(ele).addClass("active_cat");//增加样式alert($(ele).height());
}
//获取当前div下面的子div的高度
function getChildH(ele){
$(ele).addClass("active_cat");alert($(ele).children().find(".shadow_border").height());
}
/移除样式
function removeClass(ele){$(ele).removeClass("active_cat");
}
function addClass(ele){
$(ele).addClass("active_cat");
if(parseInt(ele.offsetTop)+parseInt($(ele).children().find(".shadow_border").height())>parseInt(document.body.clientHeight)){
document.body.style.height = parseInt(ele.offsetTop)+parseInt($(ele).children().find(".shadow_border").height())+20;
}
}
<div onmouseover="getHeight(ele),getChildH()">
<div>
<div>
<div>
本文介绍如何使用JavaScript获取元素及其子元素的高度,并演示了如何移除样式以适应特定需求。
7万+

被折叠的 条评论
为什么被折叠?



