Title: JavaScript TypeError when scrolling
Last modified: July 28, 2018

---

# JavaScript TypeError when scrolling

 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [7 years, 10 months ago](https://wordpress.org/support/topic/javascript-typeerror-when-scrolling/)
 * Hi!
 * When I first activated the theme and scrolled I got a console error:
 *     ```
       Uncaught TypeError: Cannot read property 'top' of undefined
       ```
   
 * This was because I had no menu set. I was able to remove it by adding:
 *     ```
       if ($('.navbar').length === 0) {
       	return
       }
       ```
   
 * I added it just before the `top-nav-collapse` class gets added on the scroll 
   event.

Viewing 1 replies (of 1 total)

 *  Theme Author [Akila Thiwanka](https://wordpress.org/support/users/akilathiwanka/)
 * (@akilathiwanka)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/javascript-typeerror-when-scrolling/#post-10748339)
 * [@jcastaneda](https://wordpress.org/support/users/jcastaneda/) Oh, I totally 
   missed your message. Thanks for letting me know. I will add an update.

Viewing 1 replies (of 1 total)

The topic ‘JavaScript TypeError when scrolling’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/akyl/1.4.1/screenshot.png)
 * Akyl
 * [Support Threads](https://wordpress.org/support/theme/akyl/)
 * [Active Topics](https://wordpress.org/support/theme/akyl/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/akyl/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/akyl/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [js](https://wordpress.org/support/topic-tag/js/)

 * 1 reply
 * 2 participants
 * Last reply from: [Akila Thiwanka](https://wordpress.org/support/users/akilathiwanka/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/javascript-typeerror-when-scrolling/#post-10748339)
 * Status: not resolved