aw-front-helpers 2.5.1 → 2.5.3

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.
package/classes/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  module.exports.GParallax = require('./globalParallax').default;
2
2
  module.exports.Nearby = require('./nearby').default;
3
3
  module.exports.FormControl = require('./formControl').default;
4
- module.exports.ModelsManager = require('./modelsManager').default;
5
4
  module.exports.Sticky = require('./sticky').default;
package/classes/sticky.js CHANGED
@@ -99,20 +99,9 @@ export default class Sticky extends EventEmitter {
99
99
 
100
100
  _onResize() {
101
101
  if (this._options.breakpointDisabled && window.innerWidth < this._options.breakpointDisabled) {
102
- if (!this._isDisabled) {
103
- this._isDisabled = true;
104
- this._dom.el.classList.remove("is-sticky", "is-sticky-end");
105
- this._dom.el.style.top = null;
106
- this._dom.el.style.width = null;
107
- this.emit('disable');
108
- }
102
+ this._setDisabled();
109
103
  return;
110
104
  }
111
- if (this._isDisabled) {
112
- this._isDisabled = false;
113
- this.emit('enable');
114
- }
115
-
116
105
  this._isSticky = false;
117
106
  this._isEndSticky = false;
118
107
  this._dom.el.classList.remove("is-sticky", "is-sticky-end");
@@ -132,6 +121,14 @@ export default class Sticky extends EventEmitter {
132
121
  wrapperTop: boudingWrapper.top + this._vars.scrollY,
133
122
  wrapperHeight: boudingWrapper.height,
134
123
  };
124
+ if (boudingContainer.height <= boudingWrapper.height) {
125
+ this._setDisabled();
126
+ return;
127
+ }
128
+ if (this._isDisabled) {
129
+ this._isDisabled = false;
130
+ this.emit('enable');
131
+ }
135
132
  this._onScrollHandler();
136
133
  });
137
134
  }
@@ -141,6 +138,15 @@ export default class Sticky extends EventEmitter {
141
138
  ["_onScroll", "_onScrollHandler", "_onResize"].forEach((fn) => (this[fn] = this[fn].bind(this)));
142
139
  }
143
140
 
141
+ _setDisabled() {
142
+ if (this._isDisabled) return;
143
+ this._isDisabled = true;
144
+ this._dom.el.classList.remove("is-sticky", "is-sticky-end");
145
+ this._dom.el.style.top = null;
146
+ this._dom.el.style.width = null;
147
+ this.emit('disable');
148
+ }
149
+
144
150
  _grabDom() {
145
151
  this._dom = {};
146
152
  this._dom.el = this._options.el.querySelector("[data-sticker-element]");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aw-front-helpers",
3
- "version": "2.5.1",
3
+ "version": "2.5.3",
4
4
  "description": "Assets helpers for projects",
5
5
  "author": "Yoann Le Poupon",
6
6
  "license": "ISC",
@@ -3,12 +3,12 @@
3
3
  }
4
4
  [data-sticker-element] {
5
5
  &.is-sticky {
6
- position: fixed;
6
+ position: fixed !important;
7
7
  z-index: 3;
8
8
  }
9
9
 
10
10
  &.is-sticky-end {
11
- position: absolute;
11
+ position: absolute !important;
12
12
  bottom: 0;
13
13
  top: auto;
14
14
  }