Timeliny
Timeliny is a responsive jQuery plugin for creating year-based interactive timelines.
What you are looking for is in the /dist/
folder.
Demo
Dependencies
It expects jQuery 2.x to work: https://github.com/jquery/jquery
Compatibility
Recent browsers such as : IE 10+, Opera, Safari, Firefox & Chrome.
Installation
jsDelivr CDN:
<!-- Before closing your <head> tag --> <!-- Before closing your <body> tag -->
Using NPM:
$ npm install jquery.timeliny
Including files:
The following example includes files located into the dist folder. Using the minified files is recommended.
<!-- Before closing your <head> tag --> <!-- Before closing your <body> tag -->
Usage
Create the basic html structure required. Don't forget data-year
and to set an active
element:
Short text here Short text here Short text here
Then, all you need to do is call the plugin inside a $(document).ready function:
;
A more complex initialization with all options set could look like this:
;
Documentation
Options
Name | Default | Description |
---|---|---|
order | asc |
Specifies that the results should be returned in ascending order. For returning the results in a descending order, set the option to desc . |
className | timeliny |
Specifies the CSS class name to use for the instanciated element. If you change this option, you will also need to change the default class name in the Css. |
wrapper | <div class="timeliny-wrapper"></div> |
Specifies the structure of the main wrapper element. Useful if you use a grid system. Example with Foundation grid: <div class="row"><div class="small-12 columns"></div></div> . |
boundaries | 2 |
Specifies the amount of 'ghost' dots/years to add on both sides of your timeline. For example, if your timeline contain years from 2002 to 2005 and boundaries is set to 2 , timeliny will transform your timeline from 2000 to 2007. |
animationSpeed | 250 |
Specifies the animation speed for transition from one date to another one. |
hideBlankYears | false |
If set to true , it will only show years that have a data-year attribute. |
Callbacks
onInit ()
Callback fired once, during the plugin initialization.
{ // Your code here.}
afterLoad (currYear)
Callback fired once, after the plugin has been fully loaded. Parameters:
- currYear: Current active year.
{ // Your code here.}
onLeave (currYear, nextYear)
Callback fired before the user leaves a particular time to go to another. Parameters:
- currYear: Current active year.
- nextYear: Year of the destination.
{ // Your code here.}
afterChange (currYear)
Callback fired after the user changed from a particular time to another. Parameters:
- currYear: New current active year.
{ // Your code here.}
afterResize ()
Callback fired when the user resize its browser.
{ // Your code here.}
onDestroy ()
Callback fired once, during the plugin destruction.
{ // Your code here.}
Methods
goToYear (year)
Change the current active year to the year given as first parameter.
;
destroy ()
Destroy the plugin instance and remove the element from the DOM.
;
Sass Settings
If you want to use Sass, simply import the file from src/jquery.timeliny.scss
in your project. You can quickly customize the plugin by editing the settings at the top of the file.
$/1
Contributing
Feel free to contribute by forking then making a pull request.
Edit files in the /src/
folder, run gulp
to copy/minify into the /dist/
folder and to watch for changes.
License
Code released under the MIT license.
Copyright (c) 2017 Sylvain Simao