Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                <section>
  <figure>
    <img src="https://cdn1.iconfinder.com/data/icons/splash-of-fruit/128/fruiticons_buttons_apple-512.png" alt="">
  </figure>
  <article>
    <h3>Apple</h3>
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto? Lorem ipsum dolor sit amet consectetur adipisicing elit. Sapiente tempore magni consequuntur sit optio dignissimos sequi nihil. Ipsum cumque, tenetur enim reprehenderit voluptatum excepturi placeat totam cupiditate minima fuga eius!</p>
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto? Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime neque, dolores aliquid placeat eligendi nam libero perferendis corrupti illum velit. Animi provident quae sunt ut sit, consequatur vel eaque fugiat.</p>
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto? Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto?</p>
     <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto? Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto?</p>
  </article>
</section>

<section>
  <figure>
    <img src="https://cdn1.iconfinder.com/data/icons/splash-of-fruit/128/fruiticons_buttons_lemon-512.png" alt="">
  </figure>
  <article>
    <h3>Lemon</h3>
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto? Lorem ipsum dolor sit amet consectetur adipisicing elit. Sapiente tempore magni consequuntur sit optio dignissimos sequi nihil. Ipsum cumque, tenetur enim reprehenderit voluptatum excepturi placeat totam cupiditate minima fuga eius!</p>
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto? Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime neque, dolores aliquid placeat eligendi nam libero perferendis corrupti illum velit. Animi provident quae sunt ut sit, consequatur vel eaque fugiat.</p>
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto? Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto?</p>
     <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto? Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto?</p>
  </article>
</section>

<section>
  <figure>
    <img src="https://cdn1.iconfinder.com/data/icons/splash-of-fruit/128/fruiticons_buttons_watermelon-512.png" alt="">
  </figure>
  <article>
    <h3>Watermelon</h3>
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto? Lorem ipsum dolor sit amet consectetur adipisicing elit. Sapiente tempore magni consequuntur sit optio dignissimos sequi nihil. Ipsum cumque, tenetur enim reprehenderit voluptatum excepturi placeat totam cupiditate minima fuga eius!</p>
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto? Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime neque, dolores aliquid placeat eligendi nam libero perferendis corrupti illum velit. Animi provident quae sunt ut sit, consequatur vel eaque fugiat.</p>
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto? Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto?</p>
     <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto? Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium odit voluptatem cupiditate autem voluptate incidunt numquam beatae! Possimus nulla autem quisquam recusandae sunt beatae ab odit cupiditate quam sapiente! Iusto?</p>
  </article>
</section>


              
            
!

CSS

              
                body, html {
  height: 100%;
  margin: 0;
}

body {
  background: #d8f7ff;
  font-family: 'Montserrat';
}

section {
  display: grid;
  grid-template-columns: 30% auto;
}

figure {
  background: #bbe2ed;
  margin: 0;
}

img {
  width: 100%;
  max-width: 250px;
  display: block;
  margin: 0 auto;
  position: sticky;
  top: 20px;
}

article {
  padding: 2em;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

h3 {
  font-size: 3em;
  margin-top: 0;
}

p {
  line-height: 2em;
}

.entered {
	-webkit-animation: flip-scale-2-ver-left 0.5s linear both;
	        animation: flip-scale-2-ver-left 0.5s linear both;
}

/* ----------------------------------------------
 * Generated by Animista on 2018-6-26 15:46:48
 * w: http://animista.net, t: @cssanimista
 * ---------------------------------------------- */

/**
 * ----------------------------------------
 * animation flip-scale-2-ver-left
 * ----------------------------------------
 */
@-webkit-keyframes flip-scale-2-ver-left {
  0% {
    -webkit-transform: translateX(0) rotateY(0) scale(1);
            transform: translateX(0) rotateY(0) scale(1);
    -webkit-transform-origin: 0% 50%;
            transform-origin: 0% 50%;
  }
  50% {
    -webkit-transform: translateX(-50%) rotateY(90deg) scale(2);
            transform: translateX(-50%) rotateY(90deg) scale(2);
    -webkit-transform-origin: 50% 50%;
            transform-origin: 50% 50%;
  }
  100% {
    -webkit-transform: translateX(-100%) rotateY(180deg) scale(1);
            transform: translateX(-100%) rotateY(180deg) scale(1);
    -webkit-transform-origin: 100% 50%;
            transform-origin: 100% 50%;
  }
}
@keyframes flip-scale-2-ver-left {
  0% {
    -webkit-transform: translateX(0) rotateY(0) scale(1);
            transform: translateX(0) rotateY(0) scale(1);
    -webkit-transform-origin: 0% 50%;
            transform-origin: 0% 50%;
  }
  50% {
    -webkit-transform: translateX(-50%) rotateY(90deg) scale(2);
            transform: translateX(-50%) rotateY(90deg) scale(2);
    -webkit-transform-origin: 50% 50%;
            transform-origin: 50% 50%;
  }
  100% {
    -webkit-transform: translateX(-100%) rotateY(180deg) scale(1);
            transform: translateX(-100%) rotateY(180deg) scale(1);
    -webkit-transform-origin: 100% 50%;
            transform-origin: 100% 50%;
  }
}




              
            
!

JS

              
                /*
* enter-view.js is library
*/

(function(factory) {
  if (typeof define === 'function' && define.amd) {
    define(factory);
  } else if (typeof module !== 'undefined' && module.exports) {
    module.exports = factory();
  } else {
    window.enterView = factory.call(this);
  }
})(() => {
  const lib = ({ selector, enter, exit, offset = 0, once = false }) => {
    let raf = null;
    let ticking = false;
    let elements = [];
    let height = 0;

    function setupRaf() {
      raf =
        window.requestAnimationFrame ||
        window.webkitRequestAnimationFrame ||
        window.mozRequestAnimationFrame ||
        window.msRequestAnimationFrame ||
        function(callback) {
          return setTimeout(callback, 1000 / 60);
        };
    }

    function getOffsetHeight() {
      if (offset && typeof offset === 'number') {
        const fraction = Math.min(Math.max(0, offset), 1);
        return height - fraction * height;
      }
      return height;
    }

    function updateHeight() {
      const cH = document.documentElement.clientHeight;
      const wH = window.innerHeight || 0;
      height = Math.max(cH, wH);
    }

    function updateScroll() {
      ticking = false;
      const targetFromTop = getOffsetHeight();

      elements = elements.filter(el => {
        const rect = el.getBoundingClientRect();
        const top = rect.top;
        const entered = top < targetFromTop;
        if (entered && !el.__enter_view) {
          enter(el);
          if (once) return false;
        } else if (!entered && el.__enter_view && exit) exit(el);

        el.__enter_view = entered;
        return true;
      });

      if (!elements.length) {
        window.removeEventListener('scroll', onScroll, true);
      }
    }

    function onScroll() {
      if (!ticking) {
        ticking = true;
        raf(updateScroll);
      }
    }

    function onResize() {
      updateHeight();
      updateScroll();
    }

    function selectionToArray(selection) {
      const len = selection.length;
      const result = [];
      for (let i = 0; i < len; i += 1) {
        result.push(selection[i]);
      }
      return result;
    }

    function selectAll(selector, parent = document) {
      if (typeof selector === 'string') {
        return selectionToArray(parent.querySelectorAll(selector));
      } else if (selector instanceof NodeList) {
        return selectionToArray(selector);
      } else if (selector instanceof Array) {
        return selector;
      }
    }

    function setupElements() {
      elements = selectAll(selector);
    }

    function setupEvents() {
      window.addEventListener('resize', onResize, true);
      window.addEventListener('scroll', onScroll, true);
      onResize();
    }

    function init() {
      const valid = selector && enter;
      if (!valid) console.error('must set selector and enter options');
      setupRaf();
      setupElements();
      setupEvents();
      updateScroll();
    }

    init();
  };

  return lib;
});

enterView({
	selector: 'img',
	enter: function(el) {
		el.classList.add('entered');
	}
});
              
            
!
999px

Console