Skip to content

Commit 8bfa048

Browse files
committed
SpacingTop feature added
1 parent d7a3849 commit 8bfa048

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/web/mage/sticky.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ define([
1111

1212
$.widget('mage.sticky', {
1313
options: {
14-
container: ''
14+
container: '',
15+
spacingTop: 0
1516
},
1617

1718
/**
@@ -42,6 +43,12 @@ define([
4243
if( !isStatic && this.element.is(':visible') ) {
4344
offset = $(document).scrollTop() - this.parentOffset;
4445

46+
if (typeof this.options.spacingTop === 'function') {
47+
offset += this.options.spacingTop();
48+
} else {
49+
offset += this.options.spacingTop;
50+
}
51+
4552
offset = Math.max( 0, Math.min( offset, this.maxOffset) );
4653

4754
this.element.css( 'top', offset );

0 commit comments

Comments
 (0)