Skip to content

Commit aad50af

Browse files
committed
adjust
1 parent 94ad912 commit aad50af

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/js-scroll-effect-module.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -223,37 +223,37 @@ export default class SCROLL_EFFECT_MODULE {
223223
_ActionChange(){
224224
if(!this.state.PosList.length) return false;
225225

226-
this.state.PosList.map((el)=>{
227-
if(el.active){
228-
if(!DOM.hasClass(el.el, this.config.classNameInview)){
226+
this.state.PosList.forEach(el => {
227+
if (el.active) {
228+
// activeな場合の処理
229+
if (!DOM.hasClass(el.el, this.config.classNameInview)) {
229230
el.count++;
230-
if(this.config.classNameInview) DOM.addClass(el.el, this.config.classNameInview);
231-
232-
// Callback function.
233-
if(this.config.on.In && typeof(this.config.on.In) === 'function'){
234-
this.config.on.In(el);
235-
}
231+
if (this.config.classNameInview) DOM.addClass(el.el, this.config.classNameInview);
232+
// Inコールバック関数の呼び出し
233+
this.callCallback(this.config.on.In, el);
236234
}
237235
} else {
238-
if(this.config.displayReverse){
239-
if(DOM.hasClass(el.el, this.config.classNameInview)){
240-
DOM.removeClass(el.el, this.config.classNameInview);
241-
242-
// Callback function.
243-
if(this.config.on.Out && typeof(this.config.on.Out) === 'function'){
244-
this.config.on.Out(el);
245-
}
246-
}
236+
// activeでない場合の処理
237+
if (this.config.displayReverse && DOM.hasClass(el.el, this.config.classNameInview)) {
238+
DOM.removeClass(el.el, this.config.classNameInview);
239+
// Outコールバック関数の呼び出し
240+
this.callCallback(this.config.on.Out, el);
247241
}
248242
}
249-
if(el.changing){
243+
// changingフラグのチェック
244+
if (el.changing) {
250245
el.changing = false;
251-
// Callback function.
252-
if(this.config.on.Change && typeof(this.config.on.Change) === 'function'){
253-
this.config.on.Change(el, el.index, el.dataset.scrollName);
254-
}
246+
// Changeコールバック関数の呼び出し
247+
this.callCallback(this.config.on.Change, el, el.index, el.dataset.scrollName);
255248
}
256249
});
257250
}
258251

252+
// コールバック関数の呼び出しを行うためのユーティリティ関数
253+
callCallback(callback, ...args) {
254+
if (callback && typeof callback === 'function') {
255+
callback(...args);
256+
}
257+
}
258+
259259
}

0 commit comments

Comments
 (0)