We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a7254cf commit 798469aCopy full SHA for 798469a
lib/web/mage/sticky.js
@@ -13,6 +13,7 @@ define([
13
options: {
14
container: '',
15
spacingTop: 0,
16
+ offsetTop: 0,
17
stickyClass: '_sticky'
18
},
19
@@ -52,6 +53,22 @@ define([
52
53
54
offset = Math.max( 0, Math.min( offset, this.maxOffset) );
55
56
+ if (offset &&
57
+ this.options.offsetTop &&
58
+ !this.element.hasClass(this.options.stickyClass)) {
59
+
60
+ var offsetTop = 0;
61
+ if (typeof this.options.offsetTop === 'function') {
62
+ offsetTop = this.options.offsetTop();
63
+ } else {
64
+ offsetTop = this.options.offsetTop;
65
+ }
66
67
+ if (offset < this.options.offsetTop) {
68
+ offset = 0;
69
70
71
72
this.element
73
.toggleClass(this.options.stickyClass, (offset > 0))
74
.css( 'top', offset );
0 commit comments