Giter Site home page Giter Site logo

ilkeryilmaz / timelinejs Goto Github PK

View Code? Open in Web Editor NEW
882.0 37.0 119.0 1.69 MB

🎬 jQuery timeline plugin, easily creates timeline slider.

Home Page: https://ilkeryilmaz.github.io/timelinejs/

JavaScript 70.85% CSS 29.15%
timeline chronology milestone jquery-timeline-plugin jquery-plugin jquery-timeline

timelinejs's Introduction

jQuery Timeline Plugin

jQuery timeline plugin, easily creates a timeline.

screenshoot

Getting Started

1.1. Installation with Package Managers

Timeline.js is now setup and ready to be used with Bower and NPM and can be installed using the following commands.

bower install timelinejs-slider
npm install timelinejs-slider

1.2. The Basics

Include the jQuery library and plugin:

<script src="js/jquery.min.js"></script> <!-- >=1.11.2 -->
<script src="js/timeline.min.js"></script>

Include the plugin css file:

<link rel="stylesheet" href="css/timeline.css">

Html markup:

<div class="timeline-container timeline-theme-1">
  <div class="timeline js-timeline">
    <div data-time="2017">your content or markup</div>
    <div data-time="2016">your content or markup</div>
    <div data-time="2015">your content or markup</div>
    <div data-time="2014">your content or markup</div>
    <div data-time="2013">your content or markup</div>
  </div>
</div><!-- /.timeline-container -->

Start plugin:

$(function(){
  $('.js-timeline').Timeline();
});

Options

Available options listed below.

$('.timeline').Timeline({
  autoplay: false,
  // value: boolean | Enables Autoplay
  autoplaySpeed: 3000,
  // value: integer | Autoplay Speed in milliseconds
  mode: 'horizontal',
  // value: horizontal | vertical, default to horizontal
  itemClass: 'timeline-item',
  // value: item class
  dotsClass: 'timeline-dots',
  // value: dots item class
  activeClass: 'slide-active',
  // value: item and dots active class
  prevClass: 'slide-prev',
  // value: item and dots prev class
  nextClass: 'slide-next',
  // value: item and dots next class
  startItem: 'first', // first|last|number
  // value: first | last | number , default to first
  dotsPosition: 'bottom',
  // value: bottom | top, default to bottom
  pauseOnHover: true,
  // value: boolean | Pause Autoplay On Hover
  pauseOnDotsHover: false,
  // value: boolean | Pause Autoplay when a dot is hovered
});

Demo

https://ilkeryilmaz.github.io/timelinejs/

Tasks

  • Basic plugin
  • Demo page and documentation
  • Migrate ES6
  • Mouse drag and touch support
  • Mobile support
  • Next/prev button
  • Advanced features (date slider, autoplay.)

timelinejs's People

Contributors

ilkeryilmaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

timelinejs's Issues

Loop ?

Any way to made a loop so after the last item the timeline go to the first one?

Similar names

An FYI before you publicise this too much, it has more-or-less the same name as another very popular JavaScript based timeline script: TimelineJS. This name is going to potentially confuse a lot of people.

Make it responsive solution

Just replace your timeline.css with this and your timeline will be responsive for displays that are <=450 pixels ;P

@charset "UTF-8";
/*!
Timeline - v0.0.2
ilker Yılmaz & greenman/rewrite123
https://github.com/ilkeryilmaz/timeline
*/
NEW STUFF:
Now it resizes at displays that are 450 pixels
*/
.timeline-container {
position: relative; }
.timeline-container::after {
content: '';
display: table;
clear: both;
}
.timeline {
width: 100%;
}
.timeline-list {
position: relative;
width: 100%;
overflow: hidden;
margin: 0;
padding: 0;
}
.timeline-list-wrap {
position: relative;
top: 0;
left: 0;
display: block;
transform: translate3d(0, 0, 0);
transition: transform 1s cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
.timeline-item {
float: left;
width: 800px;
height: 400px;
border: 1px solid #ddd;
box-sizing: border-box;
}
.timeline-dots-wrap {
position: absolute;
overflow: hidden;
}
.timeline-horizontal .timeline-dots-wrap {
width: 100%;
height: 35px;
}
.timeline-vertical .timeline-dots-wrap {
width: 65px;
height: 100%;
top: 0;
}
.timeline-dots-wrap.bottom {
bottom: -50px;
}
.timeline-dots-wrap.top {
top: -50px;
}
.timeline-dots-wrap.left {
left: -65px;
}
.timeline-dots-wrap.right {
right: -70px;
}
.timeline-dots {
margin: 0;
padding: 0;
position: relative;
width: 100%;
height: 100%;
transition: transform 1s cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
.timeline-horizontal .timeline-dots {
background: url("../img/timeline-bg.png") bottom repeat-x;
}
.timeline-vertical .timeline-dots {
background: url("../img/timeline-vertical-bg.png") left repeat-y;
}
.timeline-dots li {
transition: all 1s cubic-bezier(0.455, 0.03, 0.515, 0.955);
list-style: none;
overflow: hidden;
}
.timeline-horizontal .timeline-dots li {
float: left;
width: 50px;
text-align: center;
}
.timeline-vertical .timeline-dots li {
width: 100%;
}
.timeline-dots li.slide-active button {
color: #2972ca;
font-size: 15px;
}
.timeline-dots button {
cursor: pointer;
border: none;
outline: none;
color: #333;
font-size: 12px;
transition: all 1s cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
.timeline-horizontal .timeline-dots button {
background: url("../img/date-icon.png") bottom no-repeat;
padding-bottom: 15px;
}
.timeline-vertical .timeline-dots button {
background: url("../img/date-icon-vertical.png") left no-repeat;
padding-left: 15px;
}
.timeline-container {
width: 800px;
margin: 0 auto;
}
.timeline-list {
width: 800px;
}
.timeline-item {
width: 800px;
height: 400px;
padding: 10px;
border: 1px solid #ddd;
}

/* FROM HERE ON OUT IS NEW! */

.timeline-background{
background-repeat: no-repeat;
background-size: cover;
background-position: center;
height: 100%;
padding: 0px;
margin: 0px;
border: 0px;
}
.timeline-vertical-center{
min-height: 100%;
display: flex;
align-items: center;
}

@media (max-width:450px){
.timeline-container {
position: relative; }
.timeline-container::after {
content: '';
display: table;
clear: both;
}
.timeline {
width: 100%;
}
.timeline-list {
position: relative;
width: 100%;
overflow: hidden;
margin: 0;
padding: 0;
}
.timeline-list-wrap {
position: relative;
top: 0;
left: 0;
display: block;
transform: translate3d(0, 0, 0);
transition: transform 1s cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
.timeline-item {
float: left;
width: 350px;
height: 400px;
border: 1px solid #ddd;
box-sizing: border-box;
}
.timeline-dots-wrap {
position: absolute;
overflow: hidden;
}
.timeline-horizontal .timeline-dots-wrap {
width: 100%;
height: 35px;
}
.timeline-vertical .timeline-dots-wrap {
width: 45px;
height: 100%;
top: 0;
}
.timeline-dots-wrap.bottom {
bottom: -50px;
}
.timeline-dots-wrap.top {
top: -50px;
}
.timeline-dots-wrap.left {
left: -65px;
}
.timeline-dots-wrap.right {
right: -70px;
}
.timeline-dots {
margin: 0;
padding: 0;
position: relative;
width: 100%;
height: 100%;
transition: transform 1s cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
.timeline-horizontal .timeline-dots {
background: url("../img/timeline-bg.png") bottom repeat-x;
}
.timeline-vertical .timeline-dots {
background: url("../img/timeline-vertical-bg.png") left repeat-y;
}
.timeline-dots li {
transition: all 1s cubic-bezier(0.455, 0.03, 0.515, 0.955);
list-style: none;
overflow: hidden;
}
.timeline-horizontal .timeline-dots li {
float: left;
width: 40px;
text-align: center;
}
.timeline-vertical .timeline-dots li {
width: 100%;
}
.timeline-dots li.slide-active button {
color: #2972ca;
font-size: 15px;
}
.timeline-dots button {
cursor: pointer;
border: none;
outline: none;
color: #333;
font-size: 12px;
transition: all 1s cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
.timeline-horizontal .timeline-dots button {
background: url("../img/date-icon.png") bottom no-repeat;
padding-bottom: 15px;
}
.timeline-vertical .timeline-dots button {
background: url("../img/date-icon-vertical.png") left no-repeat;
padding-left: 15px;
}
.timeline-container {
width: 350px;
margin: 0 auto;
}
.timeline-list {
width: 350px;
}
.timeline-item {
width: 350px;
height: 400px;
padding: 10px;
border: 1px solid #ddd;
}
}

EXAMPLE:
Uses a little bootstrap for centering text and a few other things, but this template can work with a little bit of elbow grease ;P

<div class="timeline-container timeline-theme-1" id="idHandler">
<div class="timeline js-timeline">
<div data-time="2011" id="timeline-clicker">
<div class="timeline-background" style="background-image: url(IMAGE_GOES_HERE.jpg);">
<div class="timeline-vertical-center" style="width: 100%;">
<div class="text-center text-white" style="width: 100%;">
<h3><strong>TEXT GOES HERE</strong></h3>
</div>
</div>
</div>
</div>
</div>
</div>

Responsive

Hello. It's great plugin I appreciate your work ... but it have problem with mobile also it's difficult to combine it with bootstrap grid system ..

Instead of sliding

Hi,

Instead of sliding the images is it possible to fade the images on top of each other?

Regards,

Sanj

Add custom Next and Prev

This is a temporary solution.
For the moment this have a little bug on the last item of the slide.

In the Timeline.js you need to add this into the function "watch_events: function () {" after "// Dots Click "

//**************************//

		$('.timelineCustomBtnNext').on('click', function (e) {
			var nextItem = self.get_next();
			console.log(nextItem);
			self.autoplay_clear();
			self.change_slide('click', nextItem);
		});

		$('.timelineCustomBtnPrev').on('click', function (e) {
			var prevItem = self.get_prev();
			if(prevItem >= 0){
				console.log(prevItem);
				self.autoplay_clear();
				self.change_slide('click', prevItem);
			}
		});

//**************************//

you need to add this in the timeline.css in the end of the file

//**************************//

.timeline-custom .timeline-custom-btn-prev, .timeline-custom .timeline-custom-btn-next {
  width: 30px;
  height: 30px;
  border-radius: 100%;
  border: 1px solid white;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  position: absolute;
  top: calc((4rem - 20px) / 2);
  color: white;
  font-size: 12px;
  cursor: pointer;
 }

.timeline-custom .timeline-custom-btn-prev {
  left: 0;
 }

.timeline-custom .timeline-custom-btn-next {
  right: 0; 
}

//**************************//

Now in the HTML you need to add this before the -- div>class="timeline-container timeline-theme-1" --

        <div class="timeline-custom">
          <div class="timeline-custom-btn-prev timelineCustomBtnPrev">
            <i class="fas fa-chevron-left"></i>
          </div>
          <div class="timeline-custom-btn-next timelineCustomBtnNext">
            <i class="fas fa-chevron-right"></i>
          </div>
        </div>

"THIS IS ONLY FOR ONE TIMELINE.JS FOR MORE THAN ONE IT'S NECESSARY ANOTHER THINGS"

If you have any question about this "next and prev custom buttons" send me an email [email protected]

Wanted to maybe offer an update to your project?

Here is a solution to a few people's issues

/*!
	Timeline - v0.0.2
	ilker Yılmaz & greenman/rewrite123
	https://github.com/ilkeryilmaz/timelinejs
 */

/* 
	NEW STUFF:
	In the options, you can  loopAround: true to make the timeline loop around during autoplay
	Dots in the timeline now come with ids so you can perform click() on them to simulate a dot being clicked. To know what the id is going to be, include timelineName in the options for the timeline and each dot will get an id starting with timeLineName0. For timelineName: "exampleName", each dot will have an id of exampleName0, exampleName1, exampleName2, etc.... To simulate a click you would simple use $("#exampleName0").click();
	
*/

( function( $ ) {
	Timeline = {
		init: function (options, elem) {
			var self = this;
			
			if(!options.timelineName){
				options.timelineName = "exampleName";
			}
			
			self.$elem = $(elem);
			self.dom = $('body');
			self.wrapClass = '.' + self.$elem.attr('class').split(' ').join('.');
			self.dotsItem = self.wrapClass + " .timeline-dots li";
			self.options = $.extend({}, $.fn.Timeline.options, self.$elem.data(), options);

			self.initials = {
				autoPlayTimer: null,
				direction: self.options.startItem !== 'last' ?  0 : 1
			};

			self.create_timeline();
		},


		// Load Timeline
		// ----------------------------------------------------------------
		create_timeline: function () {
			var self = this;

			self.build_out();
			self.build_dots();
			self.watch_events();
		},


		// Get Total Items
		// ----------------------------------------------------------------
		get_count: function () {
			var self = this;

			var total = $('.' + self.options.itemClass, self.$elem).length;
			return total;
		},


		// Get Current Item Index
		// ----------------------------------------------------------------
		get_current: function () {
			var self = this;
			var nextItem;

			if (self.options.startItem === 'first') {
				nextItem = 0;
			} else if (self.options.startItem === 'last') {
				nextItem = self.get_count() - 1;
			} else {
				nextItem = self.options.startItem;
			}

			return nextItem;
		},


		// Get Next Item Index
		// ----------------------------------------------------------------
		get_next: function () {
			var self = this;
			var result = self.get_current() + 1;
			if(self.options.loopAround && self.get_current() >= self.get_count() -1){
				result = 0;
			}
			return result;
		},


		// Get Prev Item Index
		// ----------------------------------------------------------------
		get_prev: function () {
			var self = this;
			return self.get_current() - 1;
		},


		// Watch Timeline Events
		// ----------------------------------------------------------------
		watch_events: function () {
			var self = this;

			// Dots Click
			$(document.body).on('click', self.dotsItem, function (e) {
				var clickItem = $(this).index();

				self.autoplay_clear();
				self.change_slide('click', clickItem);
			});

			// Autoplay Start
			self.autoplay_init();

			// Content Autoplay Pause
			if(self.options.pauseOnHover) {
				self.content_pause('item');
			}

			// Dots Autoplay Pause
			if(self.options.pauseOnDotsHover) {
				self.content_pause('dots');
			}
		},


		// Autoplay
		// ----------------------------------------------------------------
		autoplay: function () {
			var self = this;
			self.autoplay_clear();

			self.initials.autoPlayTimer = setInterval(function() {
				self.change_slide();
			}, self.options.autoplaySpeed);
		},


		// Autoplay Start
		// ----------------------------------------------------------------
		autoplay_init: function () {
			var self = this;

			if(self.options.autoplay) {
				self.autoplay();
			}
		},

		// Content Slide Pause
		// ----------------------------------------------------------------
		content_pause: function (type) {
			var self = this;
			var currentItem;

			if(type === 'dots'){
				currentItem = self.wrapClass + ' .' + self.options.dotsClass;
			}else {
				currentItem = self.wrapClass + ' .' + self.options.itemClass;
			}

			$(document.body).on('mouseenter', currentItem, function (e) {
				self.autoplay_clear();
			});

			$(document.body).on('mouseleave', currentItem, function (e) {
				self.autoplay_init();
			});
		},


		// Autoplay Clear
		// ----------------------------------------------------------------
		autoplay_clear: function () {
			var self = this;

			if(self.initials.autoPlayTimer) {
				clearInterval(self.initials.autoPlayTimer);
			}
		},


		// Change Slide (default, reverse, click);
		// ----------------------------------------------------------------
		change_slide: function (type, itemIndex) {
			var self = this;
			if(!type) type='load';

			if (type === 'click'){
				self.options.startItem = itemIndex;
				self.autoplay_init();
			}else {
				if (self.get_count() - 1 > self.get_current() && self.initials.direction === 0){
					self.options.startItem = self.get_next();
				}else if(self.get_current() > 0 && self.initials.direction === 0) {
					self.options.startItem = self.get_next();
					self.change_timeline();
				}else {
					self.autoplay_clear();
				}
			}

			self.change_timeline();
		},


		// Move Slide Action
		// ----------------------------------------------------------------
		move_slide: function (type) {
			var self = this;
			var itemSize,
					totalHeight;

			var currentWrapper = $(self.wrapClass + ' .timeline-list-wrap');
			var currentItem = $(self.wrapClass + ' .' + self.options.itemClass);

			if (type === 'vertical'){
				itemSize = $(self.wrapClass + ' .timeline-list').height();
				totalHeight = currentItem.outerHeight() * (self.get_count());
				currentWrapper.height(totalHeight);
			}else {
				itemSize = $(self.wrapClass + ' .timeline-list').width();
				totalHeight = currentItem.outerWidth() * (self.get_count());
				currentWrapper.width(totalHeight);
			}

			var getTranslate = -(itemSize * self.get_current());

			if (type === 'vertical'){
				currentWrapper.css({"transform": "translate3d(0px," + getTranslate + "px, 0px)"});
			}else {
				currentWrapper.css({"transform": "translate3d(" + getTranslate + "px, 0px, 0px)"});
			}
		},


		// Make Timeline Calculations
		// ----------------------------------------------------------------
		timelime_calculations: function () {
			var self = this;

			if (self.options.mode === 'vertical') {
				self.move_slide('vertical');
			} else {
				self.move_slide('horizontal');
			}
		},


		// Move Dots Action
		// ----------------------------------------------------------------
		move_dots: function (type) {
			var self = this;

			var itemSize,
				listSize;

			var listWrapper = $(self.wrapClass + ' .timeline-list');
			var currentItem = $(self.wrapClass + ' .timeline-dots li');
			var dotsWrapper = $(self.wrapClass + ' .timeline-dots');

			if (type === 'vertical'){
				itemSize = currentItem.outerHeight(true);
				listSize = listWrapper.height();
			}else {
				itemSize = currentItem.outerWidth(true);
				listSize = listWrapper.width();
			}

			var getTranslate = -(itemSize * self.get_current()) - (-listSize / 2);
			var totalSize = itemSize * (self.get_count());


			if (type === 'vertical'){
				dotsWrapper.height(totalSize);
				dotsWrapper.css({"transform": "translate3d(0px," + getTranslate + "px, 0px)"});
			}else {
				dotsWrapper.width(totalSize);
				dotsWrapper.css({"transform": "translate3d(" + getTranslate + "px, 0px, 0px)"});
			}
		},


		// Make Timeline Dots Calculations
		// ----------------------------------------------------------------
		dots_calculations: function () {
			var self = this;


			if (self.options.mode === 'vertical') {
				self.move_dots('vertical');
			} else {
				self.move_dots('horizontal');
			}

			self.dots_position();
		},


		// Dots Position
		// ----------------------------------------------------------------
		dots_position: function () {
			var self = this;
			var dotsWrap = $(self.wrapClass + ' .timeline-dots-wrap')


			if (self.options.mode === 'vertical') {
				if (self.options.dotsPosition === 'right') {
					dotsWrap.addClass('right');
				} else {
					dotsWrap.addClass('left')
				}
			} else {
				if (self.options.dotsPosition === 'top') {
					dotsWrap.addClass('top');
				} else {
					dotsWrap.addClass('bottom')
				}
			}

		},


		// Build Timeline Dom
		// ----------------------------------------------------------------
		build_out: function () {
			var self = this;

			self.$elem.addClass('timeline-' + self.options.mode + '').addClass('timeline-initialized')
			self.$elem.children().addClass(self.options.itemClass);
			self.$elem.children().wrapAll('<div class="timeline-list-wrap"/>').parent();
			self.$elem.children().wrap('<div class="timeline-list"/>').parent();

			$('.' + self.options.itemClass, self.$elem).eq(self.get_current()).addClass(self.options.activeClass);

			self.timelime_calculations();
			self.update_ui();
		},


		// Build Dots List
		// ----------------------------------------------------------------
		build_dots: function () {
			var self = this;
			var dot, itemDate;

			dot = $('<ul />').addClass('timeline-dots');


			for (i = 0; i <= (self.get_count() - 1); i += 1) {
				itemDate = $(self.wrapClass + ' .' + self.options.itemClass).eq(i).data('time');
				dot.append($('<li />').attr("id", ""+self.options.timelineName+i).append(self.options.customPaging.call(this, self, itemDate)));
			}

			self.$dots = dot.appendTo(self.$elem);
			$(self.wrapClass + ' .timeline-dots').wrapAll('<div class="timeline-dots-wrap"/>').parent();

			self.dots_calculations();
			self.update_ui();
		},


		// Item Markup Class Update
		// ----------------------------------------------------------------
		update_ui: function () {
			var self = this;
			var timelineItem = $('.' + self.options.itemClass, self.$elem);
			var timelineDot = $(self.dotsItem);

			// Timeline Item UI
			timelineItem
				.removeClass(self.options.activeClass)
				.removeClass(self.options.prevClass)
				.removeClass(self.options.nextClass);

			timelineItem
				.eq(self.get_current())
				.addClass(self.options.activeClass);

			timelineItem
				.eq(self.get_prev())
				.addClass(self.options.prevClass);

			timelineItem
				.eq(self.get_next())
				.addClass(self.options.nextClass);


			// Timeline Dots UI
			timelineDot
				.removeClass(self.options.activeClass)
				.removeClass(self.options.prevClass)
				.removeClass(self.options.nextClass);

			timelineDot
				.eq(self.get_current())
				.addClass(self.options.activeClass);

			timelineDot
				.eq(self.get_prev())
				.addClass(self.options.prevClass);

			timelineDot
				.eq(self.get_next())
				.addClass(self.options.nextClass);
		},


		// Timeline Change
		// ----------------------------------------------------------------
		change_timeline: function () {
			var self = this;

			self.timelime_calculations();
			self.dots_calculations();
			self.update_ui();
		},
	};


	// jQuery method
	// ------------------------------------------------------------
	$.fn.Timeline = function(options) {
		return this.each(function () {
			var timeline = Object.create(Timeline);
			timeline.init(options, this);
			$.data(this, "timeline", timeline);
		});
	};


	// Default options
	// ------------------------------------------------------------
	$.fn.Timeline.options = {
		// GENERAL
		autoplay: false,
		autoplaySpeed: 3000,
		mode: 'horizontal', // vertical
		itemClass: 'timeline-item',
		dotsClass: 'timeline-dots',
		activeClass: 'slide-active',
		prevClass: 'slide-prev',
		nextClass: 'slide-next',
		startItem: 'first', // first|last|number
		dotsPosition: 'bottom', // bottom | top,
		pauseOnHover: true,
		pauseOnDotsHover: false,


		// CONTROLS
		customPaging: function(slider, date) {
			return $('<button type="button" role="button" />').text(date);
		},
	};

} ( jQuery, window, document ) );

Here is something to make adding images a little nicer :)
Use timeline-background for the image and timeline-vertical-center to center text

<style>
	.timeline-background{
		background-repeat: no-repeat; 
		background-size: cover;
		background-position: center;
		height: 100%;
		padding: 0px;
		margin: 0px;
		border: 0px;
	}
	.timeline-vertical-center{
		min-height: 100%;
		display: flex;
		align-items: center;
	}
</style>

Example of css:
I used a little bootstrap to make it easier to center text horizontally and change the text color

<div class="timeline-container timeline-theme-1">
	<div class="timeline js-timeline">
		<div data-time="20XX" id="timeline-clicker">
			<div class="timeline-background" style="background-image: url(yourImageHere.jpg);">
				<div class="timeline-vertical-center" style="width: 100%;">
					<div class="text-center text-white" style="width: 100%;">
						<h3><strong>This text will be nicely displayed!</strong></h3>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

Adding Prev and Next Buttons

In the Timeline.js you need to add this into the function "watch_events: function () {" after "// Dots Click "

//**************************//

		$(document.body).on('click', self.timeline-custom-btn-next, function (e) {
			var nextItem = self.get_next();
			self.autoplay_clear();
			self.change_slide('click', nextItem );
		});

		$(document.body).on('click', self.timeline-custom-btn-prev, function (e) {
			var prevItem = self.get_prev();
			self.autoplay_clear();
			self.change_slide('click', prevItem);
		});

//**************************//

And you need to add this in the timeline.css in the end of the file

//**************************//

`.timeline-custom .timeline-custom-btn-prev, .timeline-custom .timeline-custom-btn-next {
width: 30px;
height: 30px;
border-radius: 100%;
border: 1px solid white;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
position: absolute;
top: calc((4rem - 20px) / 2);
color: white;
font-size: 12px;
cursor: pointer;
}

.timeline-custom .timeline-custom-btn-prev {
left: 0;
}

.timeline-custom .timeline-custom-btn-next {
right: 0;
}`

//**************************//

and in the HTML you need to add this before the -- div>class="timeline-container timeline-theme-1" --

        <div class="timeline-custom">
          <div class="timeline-custom-btn-prev timelineCustomBtnPrev">
            <i class="fas fa-chevron-left"></i>
          </div>
          <div class="timeline-custom-btn-next timelineCustomBtnNext">
            <i class="fas fa-chevron-right"></i>
          </div>
        </div>

If you have any cuestion of this custom next and prev buttons send me a email [email protected]

link timeline

Hi

How to link ahref between timelines from any markup internal or external

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.