@mjhls/mjh-framework 1.0.720-navigation-scroll-fix-v2 → 1.0.720-navigation-scroll-fix-v4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -174,14 +174,14 @@ var HamMagazine = function HamMagazine(props) {
174
174
  }
175
175
  var stickyNav = window.addEventListener('scroll', function () {
176
176
  // Taking into consideration the height of the top navbar while setting the navigation fixed
177
- if (window && topNavRef && topNavRef.current && window.pageYOffset + topNavRef.current.clientHeight > navOffsetTop) {
177
+ if (window && topNavRef && topNavRef.current && window.pageYOffset !== 0 && window.pageYOffset + topNavRef.current.clientHeight > navOffsetTop) {
178
178
  if (navRef.current && navRef.current.style) {
179
179
  navRef.current.style.position = 'fixed';
180
180
  if (mastNav && mastNav.offsetHeight) navRef.current.style.top = mastNav.offsetHeight;
181
181
  }
182
182
  setIsSticky(true);
183
183
  navLinks.style.margin = 'auto';
184
- } else if (window && topNavRef && topNavRef.current && window.pageYOffset + topNavRef.current.clientHeight < navOffsetTop) {
184
+ } else {
185
185
  if (navRef.current && navRef.current.style) {
186
186
  topNavRef.current.style.paddingBottom = '0';
187
187
  navRef.current.style.position = 'relative';
@@ -167,14 +167,14 @@ var HamMagazine = function HamMagazine(props) {
167
167
  }
168
168
  var stickyNav = window.addEventListener('scroll', function () {
169
169
  // Taking into consideration the height of the top navbar while setting the navigation fixed
170
- if (window && topNavRef && topNavRef.current && window.pageYOffset + topNavRef.current.clientHeight > navOffsetTop) {
170
+ if (window && topNavRef && topNavRef.current && window.pageYOffset !== 0 && window.pageYOffset + topNavRef.current.clientHeight > navOffsetTop) {
171
171
  if (navRef.current && navRef.current.style) {
172
172
  navRef.current.style.position = 'fixed';
173
173
  if (mastNav && mastNav.offsetHeight) navRef.current.style.top = mastNav.offsetHeight;
174
174
  }
175
175
  setIsSticky(true);
176
176
  navLinks.style.margin = 'auto';
177
- } else if (window && topNavRef && topNavRef.current && window.pageYOffset + topNavRef.current.clientHeight < navOffsetTop) {
177
+ } else {
178
178
  if (navRef.current && navRef.current.style) {
179
179
  topNavRef.current.style.paddingBottom = '0';
180
180
  navRef.current.style.position = 'relative';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.720-navigation-scroll-fix-v2",
3
+ "version": "1.0.720-navigation-scroll-fix-v4",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",