offsetLeft 和offsetTop是相对于父级定位(offsetParent)的左边距离和顶部距离,没有定位就以body为准
1.自身元素的定位是fix的,offsetParsent是null
2.元素自生无定位,父级也没有定位,offsetParent是body

offsetTop,offsetLeft

相关文章:

  • 2022-12-23
  • 2021-07-25
  • 2022-01-03
  • 2021-08-19
  • 2022-01-26
  • 2021-11-23
  • 2021-07-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2021-12-19
  • 2021-12-15
相关资源
相似解决方案