item.getBoundingClientRect()
时间: 2023-10-12 07:08:17 浏览: 119
js getBoundingClientRect() 来获取页面元素的位置.docx
在这个代码中,item.getBoundingClientRect()是一个错误的调用。正确的方法应该是dom.getBoundingClientRect()。这个方法是用来获取一个元素相对于视口的位置信息,包括top、left、right和bottom等属性。通过调用dom.getBoundingClientRect()可以获取到dom元素距离视口的位置信息,然后可以用这些信息来计算元素的具体位置和大小。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [“TypeError: that.$refs.videoItem.getBoundingClientRect is not a function](https://blog.csdn.net/weixin_45503820/article/details/108641910)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [getBoundingClientRect函数获取视图位置的坑](https://blog.csdn.net/qq_42114918/article/details/106051951)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文