Skip to content

Commit

Permalink
Add top/bottom spacing in consideration to isSidebarFitsViewport method
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmed authored and Ahmed committed Mar 14, 2018
1 parent 38f4b11 commit 954fbbe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sticky-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ const StickySidebar = (() => {
* @return {Boolean}
*/
isSidebarFitsViewport(){
return this.dimensions.sidebarHeight < this.dimensions.viewportHeight;
let dims = this.dimensions;
let offset = this.scrollDirection === 'down' ? dims.lastBottomSpacing : dims.lastTopSpacing;
return this.dimensions.sidebarHeight + offset < this.dimensions.viewportHeight;
}

/**
Expand Down

0 comments on commit 954fbbe

Please sign in to comment.