Skip to content

Commit

Permalink
Merge branch 'top-more-than-zero' of github.com:lipsumar/fixed-sticky…
Browse files Browse the repository at this point in the history
… into lipsumar-top-more-than-zero
  • Loading branch information
zachleat committed Nov 11, 2013
2 parents c61236b + 31cf03b commit fa684c0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fixedsticky.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
},
viewportHeight = $( window ).height(),
position = $el.data( keys.position ),
skipSettingToFixed;
skipSettingToFixed,
elTop;

if( !initialOffset ) {
initialOffset = $el.offset().top;
Expand Down Expand Up @@ -82,7 +83,10 @@
$el.data( keys.position, position );
}

if( position.top && initialOffset < scroll ||
elTop = parseInt($(el).css('top'),10);
if(isNaN(elTop)) elTop = 0;

if( position.top && initialOffset < (scroll+elTop) ||
position.bottom && initialOffset > scroll + viewportHeight - ( height || 0 ) ) {

if( !isAlreadyOn ) {
Expand Down

0 comments on commit fa684c0

Please sign in to comment.