Skip to content

Instantly share code, notes, and snippets.

@scott2b
Created March 4, 2019 21:35
Show Gist options
  • Save scott2b/8faf1f35dc8845be702d8f3a60827914 to your computer and use it in GitHub Desktop.
Save scott2b/8faf1f35dc8845be702d8f3a60827914 to your computer and use it in GitHub Desktop.
TimlineJS3 minimal React example
<!DOCTYPE html>
<html>
<head>
<script crossorigin src="https://unpkg.com/[email protected]/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/[email protected]/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/[email protected]/babel.min.js"></script>
<link title="timeline-styles" rel="stylesheet" href="https://cdn.knightlab.com/libs/timeline3/latest/css/timeline.css">
<script src="https://cdn.knightlab.com/libs/timeline3/latest/js/timeline.js"></script>
<style>
div#timeline-embed {
height: 600px;
}
</style>
</head>
<body>
<p>Content above React container</p>
<div id="react-container"></div>
<p>Content below React container</p>
<script type="text/babel">
ReactDOM.render(<div>
<p>A React-rendered paragraph above Timeline</p>
<div id="timeline-embed"></div>
<p>A React-rendered paragraph below Timeline</p>
</div>,
document.getElementById('react-container')
);
timeline = new TL.Timeline('timeline-embed', 'https://docs.google.com/spreadsheets/d/1cWqQBZCkX9GpzFtxCWHoqFXCHg-ylTVUWlnrdYMzKUI/pubhtml');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment