• You need 5 posts to download resources. You can only download 2 resources per day. To remove these limits consider upgrading.

XF Create a time-line in Xenforo

Nick

Developer
Banned User
LV
0
 
Joined
Feb 7, 2023
Messages
491
Reaction score
128
Awards
14
Here's how you can use BBCode and CSS to create a timeline in a xenforo post.

Step 1​


Paste the following into your extra.less file
Code:
/* Start timeline css */


.timeline {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
    background:black;
}

.timeline::after {
  content: '';
  position: absolute;
  width: 6px;
  background-color: white;
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -3px;
}

.xftlcontainer {
  padding: 10px 40px;
  position: relative;
  background-color: inherit;
  width: 50%;
}

.xftlcontainer::after {
  content: '';
  position: absolute;
  width: 25px;
  height: 25px;
  right: -17px;
  background-color: white;
  border: 4px solid #FF9F55;
  top: 15px;
  border-radius: 50%;
  z-index: 1;
}

.xftlleft {
  left: 0;
}

.xftlright {
  left: 50%;
}

.xftlleft::before {
  content: " ";
  height: 0;
  position: absolute;
  top: 22px;
  width: 0;
  z-index: 1;
  right: 30px;
  border: medium solid white;
  border-width: 10px 0 10px 10px;
  border-color: transparent transparent transparent white;
}

.xftlright::before {
  content: " ";
  height: 0;
  position: absolute;
  top: 22px;
  width: 0;
  z-index: 1;
  left: 30px;
  border: medium solid white;
  border-width: 10px 10px 10px 0;
  border-color: transparent white transparent transparent;
}

.xftlright::after {
  left: -16px;
}

.xftlcontent {
  padding: 20px 30px;
  background-color: white;
  position: relative;
  border-radius: 6px;
}

/* Media queries - Responsive timeline on screens less than 600px wide */
@media screen and (max-width: 600px) {
  .timeline::after {
    left: 31px;
  }

  .xftlcontainer {
    width: 100%;
    padding-left: 70px;
    padding-right: 25px;
  }

  .xftlcontainer::before {
    left: 60px;
    border: medium solid white;
    border-width: 10px 10px 10px 0;
    border-color: transparent white transparent transparent;
  }

  .xftlleft::after, .xftlright::after {
    left: 15px;
  }

  .xftlright {
    left: 0%;
  }
}

/* End timeline CSS */

Step 2​

Go to the Custom BB Code in your admin and add the following three codes:

BB code tag: timeline
Supports option parameter: no
HTML replacement:
Code:
<div class="timeline">{text}</div>

BB code tag: tleft
Supports option parameter: Yes
HTML replacement:
Code:
<div class="xftlcontainer xftlleft">
    <div class="xftlcontent">
      <h2>{option}</h2>
      <p>{text}</p>
    </div>
  </div>

BB code tag: tright
Supports option parameter: Yes
HTML replacement:
Code:
<div class="xftlcontainer xftlright">
    <div class="xftlcontent">
      <h2>{option}</h2>
      <p>{text}</p>
    </div>
  </div>

Usage:​


This will turn this:
Code:
[timeline]

[tleft=2010]Beta version of Xenforo Launched[/tleft]

[tright="March 2011"]Stable version of Xenforo Launched[/tright]

[tleft="November 2011"]Xenforo version 1.1 released[/tleft]

[tright="August 2015"]Xenforo 1.5 released[/tright]

[tleft="November 2017"]Xenforo 2 Launched[/tleft]

[tright="The Future"]Xenforo 3 released[/tright]

[/timeline]
 
Top