MinnPost / jquery-vertical-timeline

jQuery plugin of: A beautiful vertical timeline made with Tabletop.js, Isotope.js & Handerlbarz.js. A collaboration between Balance Media and WNYC/John Keefe.
http://code.minnpost.com/jquery-vertical-timeline/
Other
122 stars 27 forks source link

jQuery Vertical Timeline

Forked from the Super Awesome Vertical Timeline. A running example can be found here. Please see the Credits below for some restrictions on use.

How to Use

Data

Create a Google Spreadsheet with the following columns (see options for different names) and publish it. An example can be found here;

Google data access issue (PLEASE READ)

See the issue how Tabletop.js accesses Google Spreadsheets. Basically you have to set up some sort of proxy for the data as some users will have problems otherwise.

Install the library

It is easiest to install with bower.

bower install jquery-vertical-timeline

This will install the dependencies as well: jQuery, Underscore, TabletopJS (this should actually be optional), MomentJS, Isotope, ImagesLoaded

Do note that Isotope's license is not clear and you may have to buy a license to use it.

Include CSS and JS

Include the CSS:

<link rel="stylesheet" href="https://github.com/MinnPost/jquery-vertical-timeline/blob/master/bower_components/jquery-vertical-timeline/dist/jquery-vertical-timeline.min.css">

Use JS directly

Include the Javascript (dependencies) and library.

<script type="text/javascript" src="https://github.com/MinnPost/jquery-vertical-timeline/raw/master/bower_components/jquery-vertical-timeline/dist/jquery-vertical-timeline.libs.js"></script>
<script type="text/javascript" src="https://github.com/MinnPost/jquery-vertical-timeline/raw/master/bower_components/jquery-vertical-timeline/dist/jquery-vertical-timeline.min.js"></script>

Use via RequireJS

See the example.js to see an example.

Use via Browserify

This should work if you can get all the dependencies to work as well.

Use

First, include a container for the timeline:

<div class="timeline-jquery-example">
</div>

Call timeline with options. Note that the key is the ID of the Google Spreadsheet, and the sheetname is the name of the sheet.

  $('.timeline-jquery-example-1').verticalTimeline({
    key: '0AsmHVq28GtVJdG1fX3dsQlZrY18zTVA2ZG8wTXdtNHc',
    sheetName: 'Posts'
  });

You can also use JSON data directly. See options below.

Options

The following options can be passed to the plugin when called:

Development

Prerequisites

All commands are assumed to on the command line, often called the Terminal, unless otherwise noted. The following will install technologies needed for the other steps and will only needed to be run once on your computer so there is a good chance you already have these technologies on your computer.

  1. Install Git.
    • On a Mac, install Homebrew, then do: brew install git
  2. Install NodeJS.
    • On a Mac, do: brew install node
  3. Optionally, for development, install Grunt: npm install -g grunt-cli
  4. Install Bower: npm install -g bower
  5. Install Ruby, though it is probably already installed on your system.
  6. Install Bundler: gem install bundler
  7. Install Sass: gem install sass
    • On a Mac do: sudo gem install sass
  8. Install Compass: gem install compass
    • On a Mac do: sudo gem install compass

Get code and install packages

Get the code for this project and install the necessary dependency libraries and packages.

  1. Check out this code with Git: git clone https://github.com/MinnPost/jquery-vertical-timeline.git
  2. Go into the template directory: cd jquery-vertical-timeline
  3. Install NodeJS packages: npm install
  4. Install Bower components: bower install

Running

  1. Run: grunt server
    • This will run a local webserver for development and you can view the application in your web browser at http://localhost:8888.
    • The server watches for files changes and rebuilds project when needed.

Build

To build or compile all the assets together for easy and efficient deployment, do the following. It will create all the files in the dist/ folder.

  1. Run: grunt

Bugs and hacks

Credits

Balance Media for the design and coding.