正文 843字数 76,287阅读

//获取当前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>
Run code
Cut to clipboard