通过id class ref 获取元素的高度和宽度 |
您所在的位置:网站首页 › jquery获取屏幕高度和宽度 › 通过id class ref 获取元素的高度和宽度 |
通过id class ref 获取元素的高度和宽度
转载
凉凉的手33 2023-06-05 16:20:18 博主文章分类:Web_UI 文章标签 获取元素高度 文章分类 Html/CSS 前端开发 dom 结构通过 id 获取高度宽度let widthid1 = document.getElementById("id1").offsetWidth let heightid = document.getElementById("id1").offsetHeight通过class 获取高度宽度let widthclass1 = document.getElementsByClassName("class1").offsetWidth let heightclass1 = document.getElementsByClassName("class1").offsetHeight通过ref 获取高度宽度let widthref1 = this.$refs.ref1.offsetWidth let heightref1 = this.$refs.ref1.offsetHeight
原文链接:https://blog.csdn.net/qq_38946996/article/details/118270528 赞 收藏 评论 分享 举报上一篇:nuxt部署时路由增加目录层次 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |