在列表中出现了一个动态气泡。我正在尝试通过jquery计算其高度,添加更多像素并设置否定的“顶部”样式来将其设置在按钮上方。但是div的高度为34px时,它返回的高度为400。
同时尝试了.height和.outerHeight
jQuery
if($(".bubble")[0]) {
$(".bubble").each(function(){
const self = this;
setTimeout(function(){
$(self).removeClass("hide");
if ($(window).width()> 1000) {
var bubblehe = ($(this).height()+14)*-1;
} else {
var bubblehe = $(this).height+14;
}
$(self).css('top',bubblehe);
}, <?php echo $myoptions['bubble_delay']; ?>)
});
$(document.body).click(function(){
$(".bubble").addClass("hide");
});
}
.bubble的CSS
.bubble {
padding:2px 0;
position:absolute;
text-align:center;
border: 1px solid #ccc;
border-radius: 5px;
box-shadow: 2px 5px 10px #cccaca;
left: 0;
right: 0;
background-color: #fff;
pointer-events: none;
color:#e98007;
font-size:12px;
transition:0.3s;
}