我需要检测bootstrap网格布局中div的大小。 目前我正在监听下面的窗口调整大小事件,然后查询DOM以找到div大小
window.addEventListener("resize", this.updateDimensions);
updateDimensions() {
// find the actual width of the parent element
let cbb = document.querySelector('.App-component-inner').getBoundingClientRect();
let cwidth = cbb.right - cbb.left;
// console.log("cwidth " + cwidth);
if (this.state.width !== cwidth) {
this.setState({
bb: cbb,
width: cwidth
});
}
}
问题是,在调用updateDimensions()
函数时,引导网格仍在执行布局。
所以我想知道Bootstrap Grid在完成布局时是否有事件发生?
答案 0 :(得分:0)
如果其他人正在寻找答案,答案是“不”。