Uncaught TypeError: Cannot read property 'top' of undefined

前端 未结 6 2316
长情又很酷
长情又很酷 2020-11-30 23:06

I apologize if this question has already been answered. I\'ve tried searching for solutions but could not find any that suited my code. I\'m still new to jQuery.

I h

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 23:42

    I ran through similar problem and found that I was trying to get the offset of footer but I was loading my script inside a div before the footer. It was something like this:

    I have some contents
    This is footer

    So, the problem was, I was calling the footer element before the footer was loaded.

    I pushed down my script below footer and it worked fine!

提交回复
热议问题