Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              #timeline-1.timeline-container
  .timeline-header
    h2.timeline-header__title Hermann Gmeiner
    h3.timeline-header__subtitle founder of SOS Children's Villages
  .timeline
    .timeline-item(data-text='founder of SOS Children&#x27;s Villages')
      .timeline__content
        img.timeline__img(src='https://www.sos-childrensvillages.org/getmedia/bd87f96a-f1e5-440e-9e1f-589ff230c3e2/Hermann_Gmeiner_HGA_Archives_Portrait_3044')
        h2.timeline__content-title
          | 1919
        p.timeline__content-desc
          | Hermann Gmeiner was born to a big family of farmers in Vorarlberg (Austria) on 23 June 1919. His mother died while he was still a young boy, and his eldest sister Elsa took on the task of caring for the smallest of the children. He was a talented child and won a scholarship to attend grammar school.
    .timeline-item(data-text='FATHER OF THE TURKS')
      .timeline__content
        img.timeline__img(src='http://gazetemanifesto.com/wp-content/uploads/2015/11/mustafa-kemal.jpg')
        h2.timeline__content-title 1893
        p.timeline__content-desc
          | Having experienced the horrors of war himself as a soldier in Russia, he was then confronted with the isolation and suffering of the many war orphans and homeless children as a child welfare worker after the end of the Second World War. In his unswerving conviction that help can never be effective as long as the children have to grow up without a home of their own, he set about implementing his idea for SOS Children's Villages.
    .timeline-item(data-text='FATHER OF THE TURKS')
      .timeline__content
        img.timeline__img(src='http://www.volpeypir.com/upload/3732.jpg')
        h2.timeline__content-title 1905
        p.timeline__content-desc
          | In 1905, Mustafa Kemal graduated from the War Academy in Istanbul with the rank of Staff Captain. Posted in Damascus, he started with several colleagues, a clandestinesociety called "Homeland and Freedom" to fight against the Sultan'sdespotism.
    .timeline-item(data-text='FATHER OF THE TURKS')
      .timeline__content
        img.timeline__img(src='http://cdn.yemek.com/uploads/2014/11/ataturk-10-kasim.jpg')
        h2.timeline__content-title 1908
        p.timeline__content-desc
          | In 1908 he helped the group of officers who toppled the Sultan. Mustafa Kemal'scareer flourished as he won his heroism in the far corners of the Ottoman Empire,including Albania and Tripoli. He also briefly served as a staff officer in Salonica andIstanbul and as a military attache in Sofia.
    .timeline-item(data-text='FATHER OF THE TURKS')
      .timeline__content
        img.timeline__img(src='http://ataturk.istanbul.gov.tr/GalleryLibrary/12.jpg')
        h2.timeline__content-title 1915
        p.timeline__content-desc
          | In 1915, when Dardanelles campaign was launched, Colonel Mustafa Kemal became anational hero by winning successive victories and finally repelling the invaders.
    .timeline-item(data-text='FATHER OF THE TURKS')
      .timeline__content
        img.timeline__img(src='http://blog.istanbul1881.com/wp-content/uploads/2016/08/atat%C3%BCrk-%C3%BCn-inan%C4%B1lmaz-karizmatik-fotograf%C4%B1_861050.jpg')
        h2.timeline__content-title 1916
        p.timeline__content-desc
          | Promotedto general in 1916, at age 35, he liberated two major provinces in eastern Turkey thatyear. In the next two years, he served as commander of several Ottoman armies inPalestine, Aleppo, and elsewhere, achieving another major victory by stopping the enemyadvance at Aleppo.
    .timeline-item(data-text='FATHER OF THE TURKS')
      .timeline__content
        img.timeline__img(src='http://manisanokta.com/wp-content/uploads/2014/07/ataturk-20.jpg')
        h2.timeline__content-title 1919
        p.timeline__content-desc
          | On May 19, 1919, Mustafa Kemal Pasha landed in the Black Sea port of Samsun to startthe War of Independence. In defiance of the Sultan's government, he rallied a liberationarmy in Anatolia and convened the Congress of Erzurum and Sivas which established thebasis for the new national effort under his leadership.
    .timeline-item(data-text='FATHER OF THE TURKS')
      .timeline__content
        img.timeline__img(src='http://www.volpeypir.com/upload/3732.jpg')
        h2.timeline__content-title 1920
        p.timeline__content-desc
          | On April 23, 1920, the GrandNational Assembly was inaugurated. Mustafa Kemal Pasha was elected to its Presidency.
          | Fighting on many fronts, he led his forces to victory against rebels and invadingarmies. Following the Turkish triumph at the two major battles at Inonu in Western Turkey,the Grand National Assembly conferred on Mustafa Kemal Pasha the title ofCommander-in-Chief with the rank of Marshal.
    .timeline-item(data-text='FATHER OF THE TURKS')
      .timeline__content
        img.timeline__img(src='http://sanatkaravani.com/wp-content/uploads/2015/11/ataturk-4.jpg')
        h2.timeline__content-title 1922
        p.timeline__content-desc
          | At the end of August 1922, the Turkish armieswon their ultimate victory. Within a few weeks, the Turkish mainland was completelyliberated, the armistice signed, and the rule of the Ottoman dynasty abolished
    .timeline-item(data-text='FATHER OF THE TURKS')
      .timeline__content
        img.timeline__img(src='https://turkcetarih.com/wp-content/uploads/2015/05/Atat%C3%BCrkveCumhuriyet.jpg')
        h2.timeline__content-title 1923
        p.timeline__content-desc
          | In July 1923, the national government signed the Lausanne Treaty with Great Britain,France, Greece, Italy, and others. In mid-October, Ankara became the capital of the new Turkish State. On October 29, the Republic was proclaimed and Mustafa Kemal Pasha wasunanimously elected President of the Republic.
    .timeline-item(data-text='FATHER OF THE TURKS')
      .timeline__content
        img.timeline__img(src='https://pbs.twimg.com/media/Cw69H8pXUAEaSqa.jpg')
        h2.timeline__content-title 1934
        p.timeline__content-desc
          | The account of Atatürk's fifteen year Presidency is a saga of dramatic modernization.With indefatigable determination, he created a new political and legal system, abolished the Caliphate and made both government and education secular, gave equal rights to women,changed the alphabet and the attire, and advanced the arts and the sciences, agricultureand industry.
          | In 1934, when the surname law was adopted, the national parliament gave him the name 
          i
            strong "Atatürk" (Father of the Turks)
    .timeline-item(data-text='FATHER OF THE TURKS')
      .timeline__content
        img.timeline__img(src='http://www.bik.gov.tr/wp-content/uploads/2016/11/20161110_2_20037273_15856882.jpg?fit=1024%2C863')
        h2.timeline__content-title 1938
        p.timeline__content-desc
          | On November 10, 1938, following an illness of a few months, the national liberator and the Father of modern Turkey died. But his legacy to his people and to the world endures.
.demo-footer
  a(href='http://www.turkishnews.com/Ataturk/life.htm', target='_blank') Source/Kaynak
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Cardo|Pathway+Gothic+One');
// Responsive
@mixin responsive() {
  @media only screen and (max-width: 767px) {
    @content;
  }
}

$content-font: Cardo;
$heading-font: 'Pathway Gothic One',
sans-serif;
$timeline-width:700px;
$timeline-container-width:100%;
.timeline {
  display: flex;
  margin: 0 auto;
  flex-wrap: wrap;
  flex-direction: column;
  max-width: $timeline-width;
  position: relative;
  &__content {
    &-title {
      font-weight: normal;
      font-size: 66px;
      margin: -10px 0 0 0;
      transition: .4s;
      padding: 0 10px;
      box-sizing: border-box;
      font-family: $heading-font;
      color: #fff;
    }
    &-desc {
      margin: 0;
      font-size: 15px;
      box-sizing: border-box;
      color: rgba(#fff, .7);
      font-family: $content-font;
      font-weight: normal;
      line-height: 25px;
    }
  }
  &:before {
    position: absolute;
    left: 50%;
    width: 2px;
    height: 100%;
    margin-left: -1px;
    content: "";
    background: rgba(255, 255, 255, .07);
    @include responsive() {
      left: 40px;
    }
  }
  &-item {
    padding: 40px 0;
    opacity: .3;
    filter: blur(2px);
    transition: .5s;
    box-sizing: border-box;
    width: calc(50% - 40px);
    display: flex;
    position: relative;
    transform: translateY(-80px);
    &:before {
      content: attr(data-text);
      letter-spacing: 3px;
      width: 100%;
      position: absolute;
      color: rgba(#fff, .5);
      font-size: 13px;
      font-family: $heading-font;
      border-left: 2px solid rgba(#fff, .5);
      top: 70%;
      margin-top: -5px;
      padding-left: 15px;
      opacity: 0;
      right: calc(-100% - 56px);
    }
    &:nth-child(even) {
      align-self: flex-end;
      &:before {
        right: auto;
        text-align: right;
        left: calc(-100% - 56px);
        padding-left: 0;
        border-left: none;
        border-right: 2px solid rgba(#fff, .5);
        padding-right: 15px;
      }
    }
    &--active {
      opacity: 1;
      transform: translateY(0);
      filter: blur(0px);
      &:before {
        top: 50%;
        transition: .3s all .2s;
        opacity: 1;
      }
      .timeline__content-title {
        margin: -50px 0 20px 0;
      }
    }
    @include responsive() {
      align-self: baseline !important;
      width: 100%;
      padding: 0 30px 150px 80px;
      &:before {
        left: 10px !important;
        padding: 0 !important;
        top: 50px;
        text-align: center !important;
        width: 60px;
        border: none !important;
      }
      &:last-child {
        padding-bottom: 40px;
      }
    }
  }
  &__img {
    max-width: 100%;
    box-shadow: 0 10px 15px rgba(0, 0, 0, .4);
  }
  &-container {
    width: $timeline-container-width;
    position: relative;
    padding: 80px 0;
    transition: .3s ease 0s;
    background-attachment: fixed;
    background-size: cover;
    &:before {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      background: rgba(99, 99, 99, 0.8);
      content: "";
    }
  }
  &-header {
    width: 100%;
    text-align: center;
    margin-bottom: 80px;
    position: relative;
    &__title {
      color: #fff;
      font-size: 46px;
      font-family: $content-font;
      font-weight: normal;
      margin: 0;
    }
    &__subtitle {
      color: rgba(255, 255, 255, .5);
      font-family: $heading-font;
      font-size: 16px;
      letter-spacing: 5px;
      margin: 10px 0 0 0;
      font-weight: normal;
    }
  }
}

// DEMO
.demo-footer {
  padding: 60px 0;
  text-align: center;
  a {
    color: #999;
    display: inline-block;
    font-family: $content-font;
  }
}
            
          
!
            
              (function($) {
  $.fn.timeline = function() {
    var selectors = {
      id: $(this),
      item: $(this).find(".timeline-item"),
      activeClass: "timeline-item--active",
      img: ".timeline__img"
    };
    selectors.item.eq(0).addClass(selectors.activeClass);
    selectors.id.css(
      "background-image",
      "url(" +
        selectors.item
          .first()
          .find(selectors.img)
          .attr("src") +
        ")"
    );
    var itemLength = selectors.item.length;
    $(window).scroll(function() {
      var max, min;
      var pos = $(this).scrollTop();
      selectors.item.each(function(i) {
        min = $(this).offset().top;
        max = $(this).height() + $(this).offset().top;
        var that = $(this);
        if (i == itemLength - 2 && pos > min + $(this).height() / 2) {
          selectors.item.removeClass(selectors.activeClass);
          selectors.id.css(
            "background-image",
            "url(" +
              selectors.item
                .last()
                .find(selectors.img)
                .attr("src") +
              ")"
          );
          selectors.item.last().addClass(selectors.activeClass);
        } else if (pos <= max - 40 && pos >= min) {
          selectors.id.css(
            "background-image",
            "url(" +
              $(this)
                .find(selectors.img)
                .attr("src") +
              ")"
          );
          selectors.item.removeClass(selectors.activeClass);
          $(this).addClass(selectors.activeClass);
        }
      });
    });
  };
})(jQuery);

$("#timeline-1").timeline();

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console