diff options
| author | adamhrv <adam@ahprojects.com> | 2019-04-03 23:24:12 +0200 |
|---|---|---|
| committer | adamhrv <adam@ahprojects.com> | 2019-04-03 23:24:12 +0200 |
| commit | 7d2043eb24cd171e809d83219e543ce9541ba821 (patch) | |
| tree | c415aae6c682093b18052d622fd201e983e18fd1 /client/index.js | |
| parent | 2db426422eedc4847618f972b02189f3d49fe03a (diff) | |
| parent | 24e4f4af71f1e146f33688822ac3e4242339faa4 (diff) | |
Merge branch 'master' of github.com:adamhrv/megapixels_dev
Diffstat (limited to 'client/index.js')
| -rw-r--r-- | client/index.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/client/index.js b/client/index.js index 5e36d341..c003a8b3 100644 --- a/client/index.js +++ b/client/index.js @@ -2,11 +2,13 @@ import React from 'react' import ReactDOM from 'react-dom' import { AppContainer } from 'react-hot-loader' import { Provider } from 'react-redux' +import 'waypoints/lib/noframework.waypoints.min.js'; import { toArray } from './util' import Applet from './applet' import { store } from './store' import appendMap from './map' +import { ModalImage } from './modalImage' function appendReactApplet(el, payload) { ReactDOM.render( @@ -18,6 +20,12 @@ function appendReactApplet(el, payload) { ) } +function appendModalImage() { + const el = document.createElement('div') + document.body.appendChild(el) + ReactDOM.render(<ModalImage />, el) +} + function fetchDataset(payload) { if (payload.command === 'face_analysis') return new Promise(resolve => resolve()) if (payload.dataset === 'info') return new Promise(resolve => resolve()) @@ -112,6 +120,24 @@ function runApplets() { } } +function buildWaypoints() { + const element = document.querySelector('.content section:nth-child(2)') + if (element) { + var waypoint = new Waypoint({ + element, + handler: function(direction) { + if (direction === 'down') { + document.body.classList.add('scrolled') + } else { + document.body.classList.remove('scrolled') + } + // console.log(direction) + // console.log('Scrolled to waypoint!') + } + }) + } +} + function main() { const paras = document.querySelectorAll('section p') // if (paras.length) { @@ -123,6 +149,8 @@ function main() { } }) runApplets() + buildWaypoints() + appendModalImage() } main() |
