Skip to content

Commit 9631492

Browse files
committed
adjust
1 parent 1e01787 commit 9631492

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/js-scroll-effect-module.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export default class SCROLL_EFFECT_MODULE {
157157
if(el.dataset && el.dataset.semOffset !== undefined) offset = Number(el.dataset.semOffset);
158158
let obj = {
159159
el: el,
160-
index: i,
160+
index: i + 1,
161161
pos: el.getBoundingClientRect().top + this.state.NumScrolltop - offset,
162162
height: el.clientHeight,
163163
height2: el.offsetHeight,
@@ -169,6 +169,25 @@ export default class SCROLL_EFFECT_MODULE {
169169
this.state.PosList.push( obj );
170170
});
171171
}
172+
173+
// Add Top body position.
174+
let obj = {
175+
el: document.body,
176+
index: 0,
177+
pos: 0,
178+
height: 0,
179+
height2: 0,
180+
count: 0,
181+
active: false,
182+
changing: false,
183+
dataset: document.body.dataset
184+
};
185+
this.state.PosList.unshift( obj );
186+
187+
// sort by position
188+
this.state.PosList.sort((a, b) =>
189+
a.pos > b.pos ? 1 : -1
190+
);
172191
}
173192

174193
_StoreElementStateAtPosList(){

0 commit comments

Comments
 (0)