Skip to content

Commit 0e479a3

Browse files
committed
Added stuck variable for better 'if' statement readability
1 parent 766292c commit 0e479a3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/web/mage/sticky.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,8 @@ define([
5353

5454
offset = Math.max(0, Math.min(offset, this.maxOffset));
5555

56-
if (offset &&
57-
this.options.offsetTop &&
58-
!this.element.hasClass(this.options.stickyClass)) {
59-
56+
var stuck = this.element.hasClass(this.options.stickyClass);
57+
if (offset && this.options.offsetTop && !stuck) {
6058
var offsetTop = 0;
6159
if (typeof this.options.offsetTop === 'function') {
6260
offsetTop = this.options.offsetTop();

0 commit comments

Comments
 (0)