Skip to content

Commit 506ea12

Browse files
committed
adjust
1 parent 4f793cb commit 506ea12

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/js-scroll-effect-module.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,17 @@ export default class SCROLL_EFFECT_MODULE {
204204
}
205205
};
206206

207+
let activeCountBefore = this.state.PosList.filter(item => item.active === true).length;
208+
209+
let flgPageBottom = this.state.NumScrolltop >= document.body.clientHeight - window.innerHeight;
210+
207211
// Store element state at PosList.
208-
this.state.PosList.forEach(el => {
209-
if (this.config.displayRatio === this.config.displayRatioReverse) {
212+
for (let _i = 0; _i < this.state.PosList.length; _i++) {
213+
const el = this.state.PosList[_i];
214+
215+
if (flgPageBottom) {
216+
setActiveState(el, true);
217+
} else if (this.config.displayRatio === this.config.displayRatioReverse) {
210218
// displayRatioとdisplayRatioReverseが同じ場合の処理
211219
if (this.state.NumScrolltop + (this.NumWindowHeight * this.config.displayRatio) > el.pos) {
212220
// 画面内に要素が表示された場合
@@ -228,11 +236,16 @@ export default class SCROLL_EFFECT_MODULE {
228236
setActiveState(el, false);
229237
}
230238
}
231-
});
239+
}
240+
241+
let activeCountAfter = this.state.PosList.filter(item => item.active === true).length;
242+
243+
// アクティブな要素の数が変化した場合の処理
244+
let _type = activeCountBefore < activeCountAfter ? 'down' : 'up';
232245

233246
// For Changed
234247
let changingCount = this.state.PosList.filter(item => item.changing === true);
235-
if(changingCount.length) this._ActionChange();
248+
if(changingCount.length) this._ActionChange(_type);
236249

237250
// Scrollコールバック関数の呼び出し
238251
this.callCallback(this.config.on.Scroll, this.state.NumScrolltop);

0 commit comments

Comments
 (0)