diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-04-02 15:50:01 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-04-02 15:50:01 +0200 |
| commit | 9280b2ad356b7f0cda38f9e14eb91b89f076e9c1 (patch) | |
| tree | 357d84e72fb65cffe8a9a6f6f42ddb097440f6c5 /client/index.js | |
| parent | 087cf70c944c09c4d03f2fbcaf7c74718ccb5f8f (diff) | |
clamp citations height. add waypoint
Diffstat (limited to 'client/index.js')
| -rw-r--r-- | client/index.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/client/index.js b/client/index.js index 5e36d341..c09aece7 100644 --- a/client/index.js +++ b/client/index.js @@ -2,6 +2,7 @@ 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' @@ -112,6 +113,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 +142,7 @@ function main() { } }) runApplets() + buildWaypoints() } main() |
