【发布时间】:2017-03-14 02:42:12
【问题描述】:
我正在尝试动态检索 Bootstrap 弹出框的 height/width。
我有我尝试抓住height/width的上下文:
console.log(context);
console.log(context.getBoundingClientRect().height);
console.log(context.getBoundingClientRect().width);
这会输出 Bootstrap 元素:
<div class="popover fade bs-tether-element bs-tether-enabled bs-tether
element-attached-middle bs-tether-element-attached-left bs-tether-target
attached-middle bs-tether-target-attached-right in" role="tooltip"
id="popover537457" style="top: 0px; left: 0px; position: absolute; transform:
translateX(904px) translateY(227px) translateZ(0px);"><h3 class="popover
title"></h3><div class="popover-content"><div class="tooltip-content">To learn
more about naming convention please <a href="#">click here</a></div></div
</div>
height/width 但是我在上面的console log 返回 0。
任何人都知道我可以如何完成检索 Bootstrap 4 弹出框的 height/width 吗?
【问题讨论】:
-
在jsfiddle中添加你的html、css和javascript...这样会更好的理解和帮助你。
标签: javascript jquery html bootstrap-4 twitter-bootstrap-4