Skip to content

Commit c4b44c2

Browse files
committed
adjust reverse ratio logic
1 parent 998d2d7 commit c4b44c2

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/js-scroll-effect-module.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,20 @@ export default class SCROLL_EFFECT_MODULE {
2525

2626
classNameInview : 'is-active',
2727

28-
displayRatio : 0.8,
29-
displayReverse : false,
30-
displayRatioReverse: null,
28+
ratio : 0.8,
29+
ratioReverse : null,
3130

32-
firstDelay : 100,
31+
reverse : false,
3332

34-
throttleInterval : 5,
33+
firstDelay : 100,
3534

3635
autoStart : true,
3736
autoStartType : 'ready', // ready, load, scroll
3837

38+
throttleInterval : 5,
39+
40+
customVarNameRatio : null, // '--sem-scroll-ratio'
41+
3942
on: {
4043
Scroll : null,
4144
Change : null,
@@ -54,11 +57,11 @@ export default class SCROLL_EFFECT_MODULE {
5457
this.timerScroll = null;
5558

5659
// adjust ratio value.
57-
if( !this.config.displayRatioReverse ) {
58-
this.config.displayRatioReverse = this.config.displayRatio;
60+
if( !this.config.ratioReverse ) {
61+
this.config.ratioReverse = this.config.ratio;
5962
} else {
60-
if( this.config.displayRatioReverse < this.config.displayRatio ) {
61-
this.config.displayRatioReverse = this.config.displayRatio;
63+
if( this.config.ratioReverse < this.config.ratio ) {
64+
this.config.ratioReverse = this.config.ratio;
6265
}
6366
}
6467

@@ -232,9 +235,9 @@ export default class SCROLL_EFFECT_MODULE {
232235

233236
if (flgPageBottom) {
234237
setActiveState(el, true);
235-
} else if (this.config.displayRatio === this.config.displayRatioReverse) {
236-
// displayRatioとdisplayRatioReverseが同じ場合の処理
237-
if (this.state.NumScrolltop + (this.NumWindowHeight * this.config.displayRatio) > el.pos) {
238+
} else if (this.config.ratio === this.config.ratioReverse) {
239+
// ratioとratioReverseが同じ場合の処理
240+
if (this.state.NumScrolltop + (this.state.NumWindowHeight * this.config.ratio) > el.pos) {
238241
// 画面内に要素が表示された場合
239242
setActiveState(el, true);
240243
} else {

0 commit comments

Comments
 (0)