Reverse in EJ2 TypeScript Timeline control
14 Mar 20242 minutes to read
You can display the Timeline items in reverse order, for different alignments by using the reverse property which provides adaptability and improves user interaction.
import { Timeline, TimelineItemModel } from '@syncfusion/ej2-layouts';
const careerProgress: TimelineItemModel[] = [
{ content: 'June 2022', oppositeContent: 'Graduated \n Bachelors in Computer Engineering' },
{ content: 'Aug 2022', oppositeContent: 'Software Engineering Internship \n ABC Software and Technology' },
{ content: 'Feb 2023', oppositeContent: 'Associate Software Engineer \n ABC Software and Technology' },
{ content: 'Mar 2024', oppositeContent: 'Software Level 1 Engineer \n XYZ Solutions' },
];
// Initializes the Timeline control
let timeline: Timeline = new Timeline({
items: careerProgress,
reverse: true,
align: 'before'
});
// Render initialized Timeline.
timeline.appendTo("#timeline");
<!DOCTYPE html>
<html lang="en">
<head>
<title>Essential JS 2 - Timeline</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/28.1.33/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/28.1.33/ej2-layouts/styles/material.css" rel="stylesheet" />
<!--style reference from app-->
<link href="styles.css" rel="stylesheet" />
<!--system js reference and configuration-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container' style="height: 350px;">
<div id="timeline"></div>
</div>
</body>
</html>
#container {
visibility: hidden;
margin-top: 30px;
padding: 30px;
}
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}