Uncaught TypeError: Cannot read property 'top' of undefined

前端 未结 6 2306
长情又很酷
长情又很酷 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:52

    I know this is extremely old, but I understand that this error type is a common mistake for beginners to make since most beginners will call their functions upon their header element being loaded. Seeing as this solution is not addressed at all in this thread, I'll add it. It is very likely that this javascript function was placed before the actual html was loaded. Remember, if you immediately call your javascript before the document is ready then elements requiring an element from the document might find an undefined value.

提交回复
热议问题