Finally made fading elements visible until first scroll.

This commit is contained in:
2018-08-14 22:00:15 +10:00
parent 22c00fa9d1
commit f9351674fd
2 changed files with 11 additions and 3 deletions

View File

@ -27,7 +27,10 @@ class ElementScrollFader extends React.Component {
constructor(props) {
super(props);
this.state = { visible: false };
this.state = {
waiting: true,
visible: false
};
this.onScrollBound = this.onScroll.bind(this);
this.updateRectangleBound = this.updateRectangle.bind(this);
this.checkEffectBound = this.checkEffect.bind(this);
@ -74,6 +77,11 @@ class ElementScrollFader extends React.Component {
checkEffect() {
if(typeof window === typeof undefined) return;
if(!this.refs || !this.refs.fader) return;
if(this.state.waiting) {
this.setState({
waiting: false
});
}
if(this.state.visible) return this.detachListener();
if(!this.rect) this.updateRectangle();
@ -104,7 +112,7 @@ class ElementScrollFader extends React.Component {
} else {
clazz += " from-top";
}
if(this.state.visible) {
if(this.state.visible || this.state.waiting) {
clazz += " is-visible";
}

View File

@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>domsPlace</title>
<title>domsPlace - Personal Site of Dominic Masters</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta charset="utf-8" />
<meta name="keywords" content="domsplace, programming, gaming, anime, livestreaming, dominic, masters, dom" />