abouolia / sticky-sidebar

😎 Pure JavaScript tool for making smart and high performance sticky sidebar.

Home Page:https://abouolia.github.io/sticky-sidebar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calc isSidebarFitsViewport

drebot92 opened this issue Β· comments

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch sticky-sidebar@3.3.1 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/sticky-sidebar/dist/sticky-sidebar.js b/node_modules/sticky-sidebar/dist/sticky-sidebar.js
index 9a7cad4..e0707ec 100644
--- a/node_modules/sticky-sidebar/dist/sticky-sidebar.js
+++ b/node_modules/sticky-sidebar/dist/sticky-sidebar.js
@@ -308,7 +308,7 @@ var StickySidebar = function () {
     }, {
       key: 'isSidebarFitsViewport',
       value: function isSidebarFitsViewport() {
-        return this.dimensions.sidebarHeight < this.dimensions.viewportHeight;
+        return this.dimensions.sidebarHeight < this.dimensions.viewportHeight - this.dimensions.topSpacing - this.dimensions.bottomSpacing;
       }
 
       /**

This issue body was partially generated by patch-package.