Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <article class="timeline">
   <div class="timeline__inner">
      <div class="timeline__nav"> <a href="javascript:void(0);" class="timeline__year active"> <span>1989</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>1992</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>1998</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>1999</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>2000</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>2001</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>2002</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>2003</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>2005</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>2006</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>2008</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>2009</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>2010</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>2011</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>2012</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>2013</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>2014</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>2015</span> </a> <a href="javascript:void(0);" class="timeline__year"> <span>2016</span> </a></div>
      <div class="timeline__frame">
         <div class="timeline__slides" style="transform: translateX(0%) translateX(0px);">
            <div class="timeline__group active">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,mountains" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 1989 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Placerat blandit vehicula vitae porttitor sagittis lectus, libero proin rutrum primis mollis curabitur quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,lakes" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 1992 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Vehicula vitae porttitor sagittis lectus, libero proin rutrum primis mollis curabitur quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,field" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 1998 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>blandit vehicula vitae porttitor sagittis lectus, libero proin rutrum primis mollis curabitur quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,valley" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 1999 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Libero proin rutrum primis mollis curabitur quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,river" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 2000 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Lorem ipsum dolor sit amet consectetur adipiscing elit class dignissim, eu semper placerat blandit vehicula vitae porttitor sagittis lectus, libero proin rutrum primis mollis curabitur quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,stream" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 2001 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Litae porttitor sagittis lectus, libero proin rutrum primis mollis curabitur quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,mud" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 2002 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Vitae porttitor sagittis lectus, libero proin rutrum primis mollis curabitur quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,dirt" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 2003 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,rocks" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 2005 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Lectus, libero proin rutrum primis mollis curabitur quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,cliffs" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 2006 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Vehicula vitae porttitor sagittis lectus, libero proin rutrum primis mollis curabitur quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,road" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 2008 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Dignissim, eu semper placerat blandit vehicula vitae porttitor sagittis lectus, libero proin rutrum primis mollis curabitur quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,sunset" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 2009 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,moon" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 2010 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,sun" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 2011 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Sagittis lectus, libero proin rutrum primis mollis curabitur quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,snow" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 2012 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Libero proin rutrum primis mollis curabitur quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,rain" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 2013 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Rutrum primis mollis curabitur quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,sand" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 2014 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,wind" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 2015 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Lorem ipsum dolor sit amet consectetur adipiscing elit class dignissim, eu semper placerat blandit vehicula vitae porttitor sagittis lectus, libero proin rutrum primis mollis curabitur quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
            <div class="timeline__group">
               <div class="timeline__image">
                  <img src="https://source.unsplash.com/700x320/?nature,forest" alt="Unsplash Placeholder Image" />
                  <span class="timeline__overlay"> 2016 </span>
               </div>
               <div class="timeline__text">
                  <h3>Some Title</h3>
                  <p>Curabitur quisque cursus. Nostra ultricies eros phasellus nibh dictumst pellentesque himenaeos praesent molestie, non duis ligula lorem maecenas fermentum feugiat cras, proin mollis consectetur velit quis diam lectus odio. Quisque scelerisque curae bibendum fringilla tempor porttitor lorem enim ridiculus vivamus, metus proin quam aliquet sed vehicula penatibus nullam.</p>
               </div>
            </div>
         </div>
      </div>
   </div>
</article>
              
            
!

CSS

              
                /*------------------------------------*\
    ::Media Queries Mixin
\*------------------------------------*/
//Usage:
// @include bp($max: 600px){ body { background:#000 } }
// @include bp($min: 600px){ body { background:#fff } }
// @include bp($min: 600px, $max: 600px){ body { background:#000 } }
// @include bp($bp-sm--max){ body { background:#fff } }

@mixin bp($media: false, $min: false, $max: false) {
    @if $media {
        @media only screen and (max-width: $media) { @content; }
    }
    @else if $min and $max {
        @media only screen and (min-width: $min) and (max-width: $max) { @content; }
    }
    @else if $min {
        @media only screen and (min-width: $min) { @content; }
    }
    @else if $max {
        @media only screen and (max-width: $max) { @content; }
    }
}

/*------------------------------------*\
    ::Breakpoints
\*------------------------------------*/
$bp-lg--max:        1140px;
$bp-md--max:        800px;
$bp-sm--max:        500px;

/*------------------------------------*\
    ::Layout
\*------------------------------------*/
$pad:               0.9375rem;
$gap:               $pad;
$gap--baby:         $pad*2.7;
$gap--big:          $pad*3.6;

/*------------------------------------*\
    ::Colors
\*------------------------------------*/

// blue-ish purple: you know, blurple
$color-1:           mediumaquamarine;
$color-1--light:     aquamarine;
$color-1--lighter:   #3FD3BB;
$color-1--dark:      darken($color-1,20%);

// orange: because it's a happy color
$color-2:           teal;
$color-2--light:     lighten($color-2,20%);
$color-2--dark:      darken($color-2,20%);

// drab: out of sight and out of mind
$color-drab:        #3e4748;
$color-drab--light:  #a0abac;
$color-drab--dark:   #3e4748;
$color-white:       #fff;

/*------------------------------------*\
    ::Timeline Layout
\*------------------------------------*/
.timeline {
    max-width: 100%;
    &__inner[class] { // for specificity
        display: flex;
        max-width: 50.257em; // image is thus about 730px at widest
        padding: 0 $gap;
        @include bp($bp-sm--max){
            flex-wrap: wrap;
        }
    }
    &__nav {
        overflow: hidden;
        position: relative;
        width: 4em;
        margin-right: 1em;
        display: flex;
        flex-wrap: wrap;
        align-items: space-between;
        padding: 0;
        @include bp($bp-sm--max){
            display: block;
            width: 100%;
            margin-right: 0;
            margin-bottom: 1em;
            white-space: nowrap;
            overflow-x: scroll;
        }
        a {
            display: block;
            width: 100%;
            display: flex;
            align-items: center;
            @include bp($bp-sm--max){
                display: inline-block !important;
                width: 25.8vw;
                padding: .5em .2em;
            }
        }
        span {
            display: block;
            width: 100%;
            text-align: center;
        }
    }
    &__frame {
        width: calc(100% - 5em);
        overflow: hidden;
        white-space: nowrap;
        font-size: 0;
        @include bp($bp-sm--max){
            width: 100%;
        }
    }
    &__group {
        font-size: 1rem; // reset from inline-block trick
        width: 100%;
        display: inline-block;
        vertical-align: top;
    }
    &__image {
        position: relative;
        width: 102%;
        margin-left: -1%; // accounts for compond sub pixel calc errors
        img {
            width: 100%;
            height: 20em;
            object-fit: cover;
            object-position: center;
            @include bp($bp-sm--max){
                height: 14em;
            }
        }
    }
    &__overlay {
        position: absolute;
        bottom: 1em;
        right: 0;
        padding: .2em .5em;
        border-radius: .2em 0 0 .2em;
    }
}

/*------------------------------------*\
    ::Timeline Style
\*------------------------------------*/
.timeline {
    &__inner {
        position: relative;
    }
    &__nav {
        background-color: $color-drab--dark;
        border-radius: .4rem;
        a {
            text-decoration: none;
            color: $color-1--light;
            border-bottom: 1px solid lighten($color-drab--dark, 25%);
            transition: 300ms;
            @include bp($bp-sm--max){
                border-bottom: 0;
            }
            &:last-child {
                border-bottom-color: transparent;
            }
            // &:nth-child(2), /* DEBUG */
            &:hover,
            &.active {
                background-color: $color-1--light;
                color: $color-drab;
            }
        }
    }
    &__frame {
        background-color: $color-drab--dark;
        border-radius: .4rem;
        overflow: hidden;
    }
    &__slides {
        transition: transform 300ms;
        backface-visibility: hidden;
    }
    &__group {
        white-space: normal;
        transition: transform 300ms;
        &.active{
            transform: scale(1);
            transition-delay: 200ms;
            transition-timing-function: cubic-bezier(0.48, 1.84, 0.8, 1.25);
        }
        &:not(.active){
            transform: scale(.9);
        }
    }
    &__image {
        background-color: $color-drab;
    }
    &__overlay {
        background-color: rgba($color-2, .9);
        color: $color-1;
        font-size: 2em;
        @include bp($bp-sm--max){
            font-size: 1em;
        }
    }
    &__text {
        padding: $gap;
        @include bp(bp-md--max){
            font-size: .8em;
        }
        h3 {
            margin: 0;
            @include bp($bp-sm--max){
                font-size: 1.5em;
            }
        }
    }
}

/*------------------------------------*\
    ::Global Stuff
\*------------------------------------*/
html,
body {
    width: 100%;
    height: 100%;
}
body {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: $color-2;
    color: $color-white;
    font-family: "Trebuchet MS", sans-serif;
}
*, *:before, *:after {
    box-sizing: border-box;
}
              
            
!

JS

              
                /*------------------------------------*\
    ::Timeline Slider
\*------------------------------------*/
var timeline = function($el){
    // cache the nav and the individual slides
    var $nav = $el.find('.timeline__nav').find('a');
    var $slides = $el.find('.timeline__slides');

    // when the nav gets clicked
    $nav.on('click', function(){
        // cache the clicked button
        var $this = $(this);
        // figure out which nav item was clicked (zero through number of slides)
        var index = $nav.index($this);
        // get rid of all active states
        $nav.removeClass('active');
        // make this nav item active
        $this.addClass('active');
        // with the slides
        $slides
            // translate nav item index * 100% to reveal this slide (subtract about .1px per for rounding errors)
            .css({
                'transform' : 'translateX('+(index * 100 * -1)+'%) translateX(-'+(index*0.1)+'px)'
            })
            // find all the inner slides
            .find('.timeline__group')
                // set them all as inactive
                .removeClass('active')
                // activate this slide only
                .eq(index)
                    .addClass('active');
    })
    // click the first slide on load
    .eq(0).trigger('click');
}

/*------------------------------------*\
    ::Implementation
\*------------------------------------*/
jQuery(function($){
    timeline($('.timeline'));
});
              
            
!
999px

Console