jQuery Programmatic

Initialize timelines with the jQuery plugin.

View the page source and read the Javascript code to see how it was done.

jQuery code:


// Render items then initialize with the jQuery plugin
var items = [
  { id: 1, title: 'Plan', content: 'Planning' },
  { id: 2, title: 'Do', content: 'Development' },
  { id: 3, title: 'Check', content: 'QA' }
];

var $items = jQuery('#jq-prog-tl .timeline__items');
items.forEach(function (it) {
  var html = '
' + it.title + '

' + it.content + '

'; $items.append(html); }); jQuery('#jq-prog-tl').timeline({ mode: 'horizontal', minWidth: 600 });