cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              <div class="font-loaded--OpenSans">
<section class="ai-stack__outermost-wrapper">
  <ul class="ai-stack__wrapper">
    <li class="ai-stack__item-wrapper ai-stack__item-wrapper--autonomy">
      <article class="ai-stack__item ai-component">
        <h3 class="ai-component__title">Autonomy</h3>
        <div class="ai-component__description-wrapper">
          <p>AI technologies at this level focus on creating systems that make their own decisions without human intervention. These systems solve problems when humans can't. For example, robots can search through rubble for disaster survivors, or sensors in self-driving cars can respond more quickly to impending accidents than human drivers.</p>
          <ul class="ai-component__staff-list">
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
          </ul>
        </div>
      </article>
    </li>
    <li class="ai-stack__item-wrapper ai-stack__item-wrapper--human-ai">
      <article class="ai-stack__item ai-component">
        <h3 class="ai-component__title">Human-AI Interaction</h3>
        <div class="ai-component__description-wrapper">
          <p>When we create artificial intelligence in this part of the stack, we're augmenting what humans can do. These technologies make our lives easier. One good example of work in this area is robotic arms attached to motorized wheelchairs that people with spinal cord injuries can direct with their gaze. Another exciting example is research that allows a computer system to interview a patient remotely to determine if they're depressed and need human intervention.</p>
          <ul class="ai-component__staff-list">
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
          </ul>
        </div>
      </article>
    </li>
    <li class="ai-stack__item-wrapper">
      <article class="ai-stack__item ai-component">
        <h3 class="ai-component__title">Planning &amp; Acting</h3>
        <div class="ai-component__description-wrapper">
          <p>Systems in this part of the stack rely on <strong>optimization</strong>, <strong>safety</strong>, the <strong>knowledge network</strong> and <strong>strategic reasoning</strong> to make the best possible decision available and learn from the information researchers give them. Though slightly less sophisticated than systems employing the blocks at the very top of the stack, planning and acting technologies still rely on advanced systems and algorithms to positively impact the world. One great example of technology that falls into this category is the national kidney exchange —a sophisticated algorithm that matches potential kidney donors with people who need transplants.</p>
          <ul class="ai-component__staff-list">
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
          </ul>
        </div>
      </article>
    </li>
    <li class="ai-stack__item-wrapper">
      <article class="ai-stack__item ai-component">
        <h3 class="ai-component__title">Decision Support</h3>
        <div class="ai-component__description-wrapper">
          <p>This layer includes technologies that help humans make decisions. Where should 500 Lyft drivers be deployed, based on information we know about events and demand? How should emergency services be distributed after a disaster? Exciting examples of research in this area include work to identify instances of human trafficking, help locate victims, and collect and synthesize enough information that trends and patterns can be discovered and used to combat the problem. </p>
          <ul class="ai-component__staff-list">
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
          </ul>
        </div>
      </article>
    </li>
    <li class="ai-stack__item-wrapper">
      <article class="ai-stack__item ai-component">
        <h3 class="ai-component__title">Modeling</h3>
        <div class="ai-component__description-wrapper">
          <p>AI systems at the top of the stack rely on computer modeling to understand information. Models use computers to construct and manipulate abstract representations of situations and natural phenomenon in the world. For example, new research has allowed scientist to analyze photos of people to track their facial features and recognize their emotional states. </p>
          <ul class="ai-component__staff-list">
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
          </ul>
        </div>
      </article>
    </li>
    <li class="ai-stack__item-wrapper">
      <article class="ai-stack__item ai-component">
        <h3 class="ai-component__title">Machine Learning</h3>
        <div class="ai-component__description-wrapper">
          <p>Machine learning focuses on creating programs that learn from experience. It advances computing through exposure to new scenarios, testing and adaptation, while using pattern- and trend-detection to help the computer make better decisions in similar, subsequent situations. A relevant example of work in machine learning is using speech recognition technologies to identify the age, sex and location of the hoax callers that plague the U.S. Coast Guard.</p>
          <ul class="ai-component__staff-list">
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
          </ul>
        </div>
      </article>
    </li>
    <li class="ai-stack__item-wrapper">
      <article class="ai-stack__item ai-component">
        <h3 class="ai-component__title">Massive-Data Management</h3>
        <div class="ai-component__description-wrapper">
          <p>Machine learning focuses on creating programs that learn from experience. It advances computing through exposure to new scenarios, testing and adaptation, while using pattern- and trend-detection to help the computer make better decisions in similar, subsequent situations. A relevant example of work in machine learning is using speech recognition technologies to identify the age, sex and location of the hoax callers that plague the U.S. Coast Guard.</p>
          <ul class="ai-component__staff-list">
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
          </ul>
        </div>
      </article>
    </li>
    <li class="ai-stack__item-wrapper">
      <article class="ai-stack__item ai-component">
        <h3 class="ai-component__title">Devices</h3>
        <div class="ai-component__description-wrapper">
          <p>The device layer is all of the sensors and components needed for machines to perceive the world around them. Traffic lights, for example can observe traffic levels and negotiate with each other to improve traffic flow. Iris-detection systems can read and identify a human eye from 40 feet away.  </p>
          <ul class="ai-component__staff-list">
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
          </ul>
        </div>
      </article>
    </li>
    <li class="ai-stack__item-wrapper">
      <article class="ai-stack__item ai-component">
        <h3 class="ai-component__title">Computing</h3>
        <div class="ai-component__description-wrapper">
          <p><strong>All</strong> artificial intelligence is built on the computer systems that came before it. This includes the systems, networks, programming languages, operating systems and interactions between devices that make computing possible.</p>
          <ul class="ai-component__staff-list">
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
          </ul>
        </div>
      </article>
    </li>
    <li class="ai-stack__item-wrapper ai-stack__item-wrapper--ethics">
      <article class="ai-stack__item ai-component">
        <h3 class="ai-component__title">
          Ethics
        </h3>
        <div class="ai-component__description-wrapper">
          <p>Ethics permeates the entire AI stack. The decisions people make as they build AI systems involve serious ethical questions that we can't ignore. At CMU, we believe that a vital component of AI is giving tomorrow's scientists the tools they need to perform ethical reasoning and the skills to create AI for good.</p>
          <ul class="ai-component__staff-list">
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
            <li><a href="#">Brad Dourif</a></li>
          </ul>
        </div>
      </article>
    </li>
  </ul>
</section>
</div>
            
          
!
            
              * {
  box-sizing: border-box;
}

body {
  background: #000;
}

.ai-stack__outermost-wrapper {
  padding: 3em;
  background: #bbb;
}

.ai-stack__wrapper {
  list-style: none;
  padding: 0;
  margin: 0;
  margin: 0 auto;
  padding: 0.75em;
  list-style: none;
  background: #fff;
}

$autonomy: #944c00;
$hai: #a3722a;

.ai-stack__item-wrapper {
  margin: 0 0 3em;

  &:nth-child(1) {
    .ai-component__title {
      background: $autonomy;

      .aiStack-processed &:hover,
      .aiStack-processed &:focus {
        background: darken($autonomy, 7);
      }
    }
  }
  &:nth-child(2) {
    .ai-component__title {
      background: $hai;

      .aiStack-processed &:hover,
      .aiStack-processed &:focus {
        background: darken($hai, 7);
      }
    }
  }
  &:nth-child(3) {
    .ai-component__title {
      background: #067;

      .aiStack-processed &:hover,
      .aiStack-processed &:focus {
        background: darken(#067, 7);
      }
    }
  }
  &:nth-child(4) {
    .ai-component__title {
      background: #247;

      .aiStack-processed &:hover,
      .aiStack-processed &:focus {
        background: darken(#247, 7);
      }
    }
  }
  &:nth-child(5) {
    .ai-component__title {
      background: #085;

      .aiStack-processed &:hover,
      .aiStack-processed &:focus {
        background: darken(#085, 7);
      }
    }
  }
  &:nth-child(6) {
    .ai-component__title {
      background: #900;

      .aiStack-processed &:hover,
      .aiStack-processed &:focus {
        background: darken(#900, 7);
      }
    }
  }
  &:nth-child(7) {
    .ai-component__title {
      background: #243;

      .aiStack-processed &:hover,
      .aiStack-processed &:focus {
        background: darken(#243, 7);
      }
    }
  }
  &:nth-child(8) {
    .ai-component__title {
      background: #003d47;
    }
  }
  &:nth-child(9) {
    .ai-component__title {
      background: #6b0000;

      .aiStack-processed &:hover,
      .aiStack-processed &:focus {
        background: darken(#6b0000, 7);
      }
    }
  }
  
  &:nth-child(10) {
    .ai-component__title {
      background: #1c96c4;

      .aiStack-processed &:hover,
      .aiStack-processed &:focus {
        background: darken(#1c96c4, 7);
      }
    }
  }
}

.ai-component__title {
  margin: 0 0 0.75em;
  padding: 0.5rem 0.75rem;
  font-size: 1.5em;
  font-weight: 300;
  color: #fff;
  transition: background 0.25s;
}

.ai-component__description-wrapper {
  padding: 0.5rem 0.75rem;
}

.ai-component__staff-list {
  columns: 12em auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

/**
 * Styles with JS
 */
.aiStack-processed {
  --stack-bg-color: #900;
  &.ai-stack__outermost-wrapper {
    position: relative;
    display: grid;
    grid-template: 1fr / 1fr;
    align-items: start;
    padding: 3rem;
    background: #bbb;
    font-size: 0.75rem;
    @media (min-width: 48em) {
      font-size: 1rem;
    }
  }
  
  .ai-stack__wrapper,
  .js-ai-stack__info-wrapper,
  .js-ai-stack__overlay {
    position: relative;
    z-index: 1;
    grid-area: 1 / 1;
    max-width: 50em;
    min-width: 40em;
    margin: auto;
  }


  .ai-stack__wrapper {
    display: grid;
    grid-template: 1fr / auto auto 5.8125em;
    grid-template-areas:
      "component1 component2 ethics"
      "component3 component3 ethics"
      "component4 component4 ethics"
      "component5 component5 ethics"
      "component6 component6 ethics"
      "component7 component7 ethics"
      "component8 component8 ethics"
      "component9 component9 ethics"
    ;
    grid-row-gap: 0.3125em;
    justify-items: stretch;
    align-items: start;
    padding: 0.75em;
    list-style: none;
    background: #fff;
  }

  .ai-stack__item-wrapper {
    margin: 0;

    &:nth-child(1) {
      grid-area: component1;
    }
    &:nth-child(2) {
      grid-area: component2;
    }
    &:nth-child(3) {
      grid-area: component3;
    }
    &:nth-child(4) {
      grid-area: component4;
    }
    &:nth-child(5) {
      grid-area: component5;
    }
    &:nth-child(6) {
      grid-area: component6;
    }
    &:nth-child(7) {
      grid-area: component7;
    }
    &:nth-child(8) {
      grid-area: component8;
    }
    &:nth-child(9) {
      grid-area: component9;
    }
  }
  
  .ai-component__title {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0.75em 1em;
    border: 0;
    box-shadow: none;
    appearance: none;
    font-size: 1.5em;
    line-height: 1.4;
    text-align: center;
    
    > span {
      display: block;
      border-bottom: 0.0625rem solid rgba(255, 255, 255, 0);
      transition: border-color 0.15s;
    }
    
    span span {
      display: block;
      transition: transform 0.5s ease-out;
    }
    
    &:hover,
    &:focus {
      > span {
        border-bottom: 0.0625rem solid rgba(255, 255, 255, 0.4);
      }
      
      span span {
        transform: translate(0, -0.125em);
      }
    }      

  }
  
  /**
   * Setup diagon line between top two items
   */
  .ai-stack__item-wrapper--autonomy {
    .ai-component__title {
      padding-right: 1.5em;
    }
  }

  .ai-stack__item-wrapper--human-ai {
    position: relative;

    .ai-component__title {
      &:before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        left: -0.5em;
        display: block;
        width: 0.75em;
        background: $hai;
        border-left: 0.3125rem solid #fff;
        transform: skew(15deg);
        transition: background 0.25s;
      }

      &:hover:before,
      &:focus:before {
        background: darken($hai, 7);
      }
    }
  }

  .ai-stack__item-wrapper--ethics {
    grid-area: ethics;
    align-self: stretch;
    margin-left: 0.3125em;

    .ai-component {
      height: 100%;
    }

    .ai-component__title {
      position: relative;
      display: block;
      height: 100%;

      &:before {
        content: '';
        position: absolute;
        top: 0.5em;
        bottom: 0.5em;
        left: 0;
        display: block;
        width: 0.75em;
        border-radius: 0 0.3125em 0.3125em 0;
        background: #fff;
      }
      
      > span {
        position: absolute;
        top: 50%;
        left: 50%;
        display: inline-block;
        transform: translate(-50%, -50%) rotate(90deg) translate(0, -0.25em);
      }
    }
  }

  .ai-stack__item {
    height: 100%;
  }

  .ai-component__description-wrapper {
    height: 0;
    overflow: hidden;
  }

  .js-ai-stack__info-wrapper {
    position: relative;
    z-index: 2;
    display: none;
    padding: 2em 2.5em;
    align-self: center;
    background: #fff;
    background: rgba(255, 255, 255, 0.97);
  }
  
  .js-ai-stack__info-title {
    font-size: 1.5em;
    margin: 0 6rem 0 0;
    padding: 0.5em 0 1rem;
  }
  
  .js-ai-stack__info-title-swatch {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0.5rem;
    background: #900;
    background: var(--stack-bg-color);
  }
  
  .js-ai-stack__info-wrapper-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
    width: 4.5rem;
    height: 5rem;
    background: transparent;
    border: 0;
    appearance: none;
    font-size: 0.75em;

    &:before,
    &:after {
      content: '';
      position: absolute;
      top: 60%;
      right: 60%;
      display: block;
      width: 0.125em;
      height: 2em;
      background: #900;
      background: var(--stack-bg-color);
    }

    &:before {
      transform: translate(-50%, -50%) rotate(-45deg);
    }

    &:after {
      transform: translate(-50%, -50%) rotate(45deg);
    }
  }
  
  .js-ai-stack__overlay {
    justify-self: stretch;
    align-self: stretch;
    width: auto;
    height: auto;
    max-width: 200%;
    max-height: 200%;
    margin: -3em; /* Negate padding */
    z-index: 1;
    display: none;
    background: rgba(0, 0, 0, 0.3);
  }
}

            
          
!
            
              console.clear();
var $outerWrapper = $('.ai-stack__outermost-wrapper');

if ($outerWrapper.length && !$outerWrapper.hasClass('aiStack-processed')) {
  var $ = jQuery;
  var $aiStackItem = $outerWrapper.find('.ai-stack__item');
  var stackHtml = {};
  var stackSwatches = {};

  var $infoWrapper = $('<div class="js-ai-stack__info-wrapper"></div>');
  var $overlay = $('<div class="js-ai-stack__overlay"></div>');
  var $infoWrapperClose = $('<button class="js-ai-stack__info-wrapper-close"><span class="element-invisible">Close</span></button>');
  
  $outerWrapper.append($infoWrapper).append($overlay);

  /**
   * Closes the info wrapper
   */
  function closeInfoWrapper() {
    var currentStack =   $outerWrapper.data('currentStack');
  
    $infoWrapper.removeClass('js-ai-stack__info-wrapper--active');
    $infoWrapper.fadeOut(250);
    $overlay.fadeOut(250);
    if (currentStack !== 'none' && typeof stackHtml[currentStack] === 'string') {
      $outerWrapper.find('[data-stack-name="' + currentStack + '"]').focus();
    }
    $outerWrapper.data('currentStack', 'none');
  }

  $overlay.click(function() {
    closeInfoWrapper();
  });

  /**
   * Update the content in Info Wrapper
   */
  function updateInfoWrapperContent(headline) {
    if (typeof stackHtml[headline] === 'string') {
      $infoWrapper.html(
        '<h2 class="js-ai-stack__info-title">' + 
          headline  + 
          '<div class="js-ai-stack__info-title-swatch"></div>' +
        '</h2>' +
        stackHtml[headline]
      ).prepend($infoWrapperClose);
      if (!$infoWrapper.hasClass('js-ai-stack__info-wrapper--active')) {
        $infoWrapper.attr('style', null);
        $infoWrapper.fadeIn(500);
        $overlay.fadeIn(250);
        $infoWrapper.addClass('js-ai-stack__info-wrapper--active');
      }
      
      $outerWrapper[0].style.setProperty('--stack-bg-color', stackSwatches[headline]);
      
      $outerWrapper.data('currentStack', headline);

      // For them keyboard navigating peeps, move the focus
      $infoWrapperClose.focus();

      $infoWrapperClose.click(function() {
        closeInfoWrapper();
      });
    }
  }

  /**
   * Setup each item
   */
  $aiStackItem.each(function(index, element) {
    var $element = $(element);
    var $headlineElement = $element.find('.ai-component__title');
    var headlineText = $headlineElement.text().trim();
    var $copy = $element.find('.ai-component__description-wrapper');
    var buttonHtml =
      '<button class="ai-component__title" data-stack-name="' + headlineText + '"><span><span>' +
        $headlineElement.html() +
      '</span></span></button>';

    $copy.attr('hidden', 'hidden');
    stackHtml[headlineText] = $copy.html();
    stackSwatches[headlineText] = $headlineElement.css('background-color');
    
    // Make headline a button to reflect functionality
    $headlineElement.replaceWith(buttonHtml);
    $headlineElement = $element.find('.ai-component__title');

    $headlineElement.click(function() {
      updateInfoWrapperContent(headlineText);
    });
  });

  $outerWrapper.data('currentStack', 'none');
  $outerWrapper.addClass('aiStack-processed');
}
            
          
!
999px
Loading ..................

Console