Forked from the Super Awesome Vertical Timeline. A running example can be found here. Please see the Credits below for some restrictions on use.
Create a Google Spreadsheet with the following columns (see options for different names) and publish it. An example can be found here;
title
- Title of the post.title icon
- URL to an icon to use for the title. Should be a 20x20px image.date
- Needs to be in one of the following formats: 'MMM DD, YYYY', 'MM/DD/YYYY', 'M/D/YYYY', 'DD MMM YYYY'. A different parsing format can be used with the dateParse
option.display date
- How to display the date (i.e. Jan 1). This will appear in the small box in the spine and should be very short.photo url
- URL to a photo.caption
- Caption for the photo.body
- Body text.read more url
- URL for the read more link.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.
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 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">
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>
See the example.js to see an example.
This should work if you can get all the dependencies to work as well.
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.
The following options can be passed to the plugin when called:
key
: This is the ID of the Google Spreadsheet.
0AsmHVq28GtVJdG1fX3dsQlZrY18zTVA2ZG8wTXdtNHc
sheetName
: This is name of the sheet in the Google Spreadsheet.
Posts
dateParse
: A moment.js parser formatting string or array that will parse the date
field.
['MMM DD, YYYY', 'MM/DD/YYYY', 'M/D/YYYY', 'DD MMM YYYY']
defaultDirection
: This is default order of the timeline.
newest
, oldest
newest
defaultExpansion
: This is default state of the posts.
expanded
, collapsed
expanded
groupFunction
: The function that will handle the grouping of the timeline. There are two functions that can be called with a string, otherwise provide your own custom function.
groupSegmentByYear
, groupSegmentByDecade
, groupSegmentByDay
groupSegmentByYear
sharing
: This turns off and on sharing, but currently should not be used.
false
, true
false
gutterWidth
: The distance in pixels between post bodies.
56
width
: The CSS-valid width of the timeline. The default is auto
and will use the container.
auto
handleResize
: Enables handling the resize of the timeline to adjust widths. This is a bit buggy.
false
, true
false
columnMapping
: This maps specific columns. This should be an a simple object, where the key is the value is the column expected by the timeline, and the name of the column in the spreadsheet.
{ 'title': 'title', 'title_icon': 'title icon', 'date': 'date', 'display_date': 'display date', 'photo_url': 'photo url', 'caption': 'caption', 'body': 'body', 'read_more_url': 'read more url', 'title': 'title' }
postTemplate
: HTML template for each post.
groupMarkerTemplate
: HTML template for each group marker.
buttonTemplate
: HTML template for the top buttons.
timelineTemplate
: HTML template for the timeline and middle line.
data
: A javascript array of objects that can be substituted for getting data from a Google Spreadsheet. See the example.json
file for an example structure of the data.
tabletopOptions
: Overrided tabletop options. See Tabletop project.
{}
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.
brew install git
brew install node
npm install -g grunt-cli
npm install -g bower
gem install bundler
gem install sass
sudo gem install sass
gem install compass
sudo gem install compass
Get the code for this project and install the necessary dependency libraries and packages.
git clone https://github.com/MinnPost/jquery-vertical-timeline.git
cd jquery-vertical-timeline
npm install
bower install
grunt server
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.
grunt
Balance Media for the design and coding.