somewebmedia/hc-sticky — pull request #10 by alexcason (2014-08-18 10:55:46+00:00)
Title: Add check to onscroll functionality to ensure element is visible

The scroll event is triggered for all instances of hcSticky on the page, even if they're not visible. This was causing a bug where, after scrolling, the hcSticky element which was hidden would snap to the top of the page with fixed positioning. The bug is demonstrated in the following gif:

![hc-sticky-bug](https://cloud.githubusercontent.com/assets/807425/3950465/911b1d32-26c5-11e4-8165-f049bcde5f27.gif)

I have added a check to the onscroll functionality to ensure that the element is visible before continuing. This resolves the bug demonstrated above.