Firefox and Chrome give different values for offsetTop

后端 未结 8 1934
囚心锁ツ
囚心锁ツ 2021-02-14 14:58

I am trying to position an span element (let us call it \"the tooltip span\") relative to a input field. To do this, I am wrapping the tooltip span and the input field in anothe

相关标签:
8条回答
  • 2021-02-14 15:48

    If you get "0" in chrome, see if you are targeting an empty element like "a". It needs to wrap something in order to return the correct offset.

    0 讨论(0)
  • 2021-02-14 15:50

    You Can try using

    $(window).load 
    

    instead of

    $(document).ready
    

    because Explorer and Chrome sets proper offsets only after images have been fully loaded.

    0 讨论(0)
提交回复
热议问题