Skip to content

Commit 998d2d7

Browse files
committed
add config customVarNameRatio
1 parent 72c59cf commit 998d2d7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/js-scroll-effect-module.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ export default class SCROLL_EFFECT_MODULE {
224224
for (let _i = 0; _i < this.state.PosList.length; _i++) {
225225
const el = this.state.PosList[_i];
226226

227+
if(this.config.customVarNameRatio){
228+
let _ratio = (this.state.NumScrolltop + this.state.NumWindowHeight - el.pos) / this.state.NumWindowHeight;
229+
let _ratio2 = Math.floor(_ratio * 100) / 100;
230+
el.el.style.setProperty('--scroll-ratio', _ratio2);
231+
}
232+
227233
if (flgPageBottom) {
228234
setActiveState(el, true);
229235
} else if (this.config.displayRatio === this.config.displayRatioReverse) {

0 commit comments

Comments
 (0)