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


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


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.


                <div class="container">
  <div class="sections">
    <div class="section active" data-bgcolor="#364652">
      <h2 class="section--header">Bronte, Australia</h2>
      <div class="section--image"><img src="" /></div>
    <div class="section" data-bgcolor="#C1A5A9">
      <h2 class="section--header">Kénitra, Morocco</h2>
      <div class="section--image"><img src="" /></div>
    <div class="section" data-bgcolor="#4ECDC4">
      <h2 class="section--header">Black Mountain, CA</h2>
      <div class="section--image"><img src="" /></div>
    <div class="section" data-bgcolor="#D4CBE5">
      <h2 class="section--header">Zermatt, Switzerland</h2>
      <div class="section--image"><img src="" /></div>
        <div class="section" data-bgcolor="#EDD4B2">
      <h2 class="section--header">Yellowstone, USA</h2>
      <div class="section--image"><img src="" /></div>



                @import url('');

:root {
  --color-text: #fff;
	--color-bg: #ddd;
  --font-text: 'Nanum Gothic Coding', monospace;
  --fontsize-text: 8vw;

body {
  min-height: 100vh;
	color: #000;
	color: var(--color-text);
	background-color: #fff;
	background: var(--color-bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
  transition: background .3s;

.sections {
  position: relative;
  display: block;
  padding: 0 6vmax;

.section {
  position: relative;
  min-height: 100vh;

.section--image {
	display: block;
  position: relative;
  max-width: 100%;
  margin: 10vh 0 30vh auto;
  opacity: 0;
  transition: opacity .3s;
  .active & {
    opacity: 1;
  img {
    display: block;
    position: relative;
    max-width: 90%;
    max-height: 100vh;
    margin: 0 0 0 auto;

.section--header {
  font-size: calc(var(--fontsize-text));
	font-family: var(--font-text);
	position: fixed;
	bottom: 5vmax;
	left: 0;
	padding-left: 5vmax;
	z-index: 1000;
	line-height: 1;
  font-weight: 300;
  opacity: 0;
  animation-duration: .65s;
  animation-fill-mode: both;
  .active & {
    animation-name: fadeInUp;

@keyframes fadeInUp{
  0% {
    transform: translate3d(0,55%,0);
  } to {
    transform: translateZ(0);


                // Get all of the images that are marked up to fade in
const images = document.querySelectorAll('.js-lazyload-image');

const sections = document.querySelectorAll('.section');

let config = {
  rootMargin: '0px',
  threshold: .5

let observer = new IntersectionObserver((entries) => {
  entries.forEach(entry => {
    if (entry.isIntersecting) {

}, config);

sections.forEach(section => {

function intersectionHandler(entry) {
  const current = document.querySelector('');
  const next =;
  const header = next.querySelector(".section--header");

  if (current) {
  if (next) {
    next.classList.add('active');"--color-bg", next.dataset.bgcolor);

images.forEach(image => {

function preloadImage(img) {
  const src = img.getAttribute('data-src');
  if (!src) { return; }
  img.src = src;

// function onIntersection(entries) {
//   // Loop through the entries
//   for (var i = 0, len = entries.length; i < len; i++) {
//     // Are we in viewport?
//     if (entries[i].intersectionRatio > 0) {
//       console.log('in viewport');

//       // Stop watching and load the image
//       observer.unobserve(entries[i].target);
//       entries[i].target.classList.add('in-viewport');
//     }
//   }
// }