美文网首页
getBoundingClientRect().width和of

getBoundingClientRect().width和of

作者: 小二子SAMA | 来源:发表于2022-01-28 11:15 被阅读0次

    getBoundingClientRect().width 和 offsetWidth的结果基本是一致的。
    但是当元素进行了transfrom 操作,getBoundingClientRect().width展示的是操作后的真实渲染宽度。而offsetWidth是未transfrom 操作的宽度。


    image.png
    image.png

    相关文章

      网友评论

          本文标题:getBoundingClientRect().width和of

          本文链接:https://www.haomeiwen.com/subject/drazhrtx.html