(function ($) {
$.fn.jflatTimeline = function (options) {
/**------------------ SETTING PARAMETERS ------------------**/
var timelinedates = new Array();
var date_sort_asc = function (date1, date2) {
// This is a comparison function that will result in dates being sorted in
// ASCENDING order. As you can see, JavaScript's native comparison operators
// can be used to compare dates. This was news to me.
if (date1 > date2) return -1;
if (date1 < date2) return 1;
return 0;
};
var current_year = 0;
var current_month = 0;
var scroll_count = 2;
var scrolled = 0;
var scroll_time = 500;
var month = new Array();
month[0] = "January";
month[1] = "February";
month[2] = "March";
month[3] = "April";
month[4] = "May";
month[5] = "June";
month[6] = "July";
month[7] = "August";
month[8] = "September";
month[9] = "October";
month[10] = "November";
month[11] = "December";
var config = {};
if (options) {
$.extend(config, options);
}
/**------------------ BEGIN FUNCTION BODY ------------------**/
return this.each(function () {
selector = $(this);
if (options.scroll) scroll_count = parseInt(options.scroll);
if (options.width) selector.css('width', options.width);
if (options.scrollingTime) scroll_time = options.scrollingTime;
/**------------------ INSERT YEAR MONTH BAR------------------**/
//
if (!selector.children('.timeline-wrap').children('.event.selected').length) selector.children('.timeline-wrap').children('.event:first-child').addClass('selected');
//This store the selected year to 'current_year'
current_year = (new...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.