diff --git a/src/components/NavBar.jsx b/src/components/NavBar.jsx
index 69e77ea..89a5fc8 100644
--- a/src/components/NavBar.jsx
+++ b/src/components/NavBar.jsx
@@ -25,7 +25,7 @@ const NavBar = ({ color }) => {
setClose('navbar__closed')} />
- Profil
+ Profil
Kompetisi
Galeri
diff --git a/src/pages/index.jsx b/src/pages/index.jsx
index a52a769..21585a5 100644
--- a/src/pages/index.jsx
+++ b/src/pages/index.jsx
@@ -23,22 +23,26 @@ const Homepage = () => {
setProgress(Math.ceil(targetIndex/sectionCount*100) + '%');
}
+ function handleHashes() {
+ let hashval = window.location.hash.substr(1);
+ let searchArray = [...hashval.split('?'), ''][1].split('&').map(x => x.split('=', 2));
+ let search = {};
+ for (let s of searchArray) {
+ search[s[0]] = s[1];
+ }
+ console.log(search)
+ if (!search['content']) search['content'] = 'hero';
+ scrollTo(hashes.indexOf(search['content']));
+ }
let scrollTo = undefined;
function handleScrollInit({ scrollControl }) {
scrollTo = scrollControl.scrollTo.bind(scrollControl);
if (window.location.hash.substr(1)) {
- let hashval = window.location.hash.substr(1);
- if (hashval[0] == '/') {
- redirect(hashval);
- } else {
- scrollTo(hashes.indexOf(window.location.hash.substr(1)));
- }
+ handleHashes();
}
- window.addEventListener('hashchange', () => {
- scrollTo(hashes.indexOf(window.location.hash.substr(1)));
- });
+ window.addEventListener('hashchange', handleHashes);
}
return (