I am using this jsfiddle: jsfiddle
In my site, I am getting the following error: Uncaught TypeError: Cannot read property 'top' of undefined
The line where it breaks of the jsfiddle:
var sidebarTop = $sidebar.position().top;
What could be the reason?
Just to give an idea of what I am trying to solve. I have a div in top of page, and set its position to fixed. When user scroll to the bottom of page, this div overlaps with the footer. I need to to stop (stick) this div in some place and does not go more to the bottom once it passes some point