-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathApp.js
More file actions
65 lines (56 loc) · 1.53 KB
/
App.js
File metadata and controls
65 lines (56 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import React from 'react';
import Navbar from "./components/Navbar";
import Intro from "./components/Intro";
import About from './components/About';
import Education from './components/Education';
import Projects from "./components/Projects";
import Contact from './components/Contact';
import Footer from "./components/Footer";
import "./styles/index.scss";
import "../node_modules/aos/dist/aos.css";
import AOS from "aos";
class App extends React.Component {
constructor(props) {
super(props);
AOS.init();
}
componentDidMount() {
var btn = document.getElementById('go-top');
//Navbar Initially Hidden
var navbar = document.getElementById('navbar');
navbar.style.opacity = 0;
navbar.style.transition = 'all .4s linear';
window.onscroll = function () { scrollFunction() };
function scrollFunction() {
if (document.body.scrollTop > 620 || document.documentElement.scrollTop > 620) {
btn.style.display = 'block';
navbar.style.opacity = 1;
}
else {
btn.style.display = 'none';
navbar.style.opacity = 0;
}
}
btn.addEventListener('click', () => {
document.body.scrollTop = 0; //Safari
document.documentElement.scrollTop = 0;//For Chrome ,Firefox, IE & Opera
});
}
componentWillReceiveProps() {
AOS.refresh();
}
render() {
return (
<>
<Navbar />
<Intro />
<About />
<Education />
<Projects />
<Contact />
<Footer />
</>
);
}
}
export default App;