search

Home  >  Q&A  >  body text

javascript - How to get the height of an element accurately to decimal places in js (non-jq)

Use offsetHeight to get the height of the element and find it is an integer ,

But in the console of Google Chrome, you can see that the height actually has decimals,

Due to the precise scrolling operation, it must be precise, please help.

怪我咯怪我咯2790 days ago555

reply all(1)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 13:22:53

    After looking at the source code of jq, I found that the height returned by getComputedStyle is accurate to decimals

    reply
    0
  • Cancelreply