Pen Settings



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


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


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.


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.


                <div class="fixed">
  <div class="container">
    <div class="description panel blue">
      <div><h1>Horizontal snapping sections (simple)</h1>
        <p>Scroll vertically to scrub the horizontal animation. It also dynamically snaps to the sections in an organic way based on the velocity. The snapping occurs based on the natural ending position after momentum is applied, not a simplistic "wherever it is when the user stops".</p>
        <div class="scroll-down">Scroll down<div class="arrow"></div></div>

    <section class="panel red">
    <section class="panel orange">
    <section class="panel purple">
    <section class="panel green">
    <section class="panel gray">


  <a href="">
    <img class="greensock-icon" src="" width="200" height="64" />


                body { height: 500vw; }
.container {
  position: relative;
  height: 100%;
  display: flex;
  flex-wrap: nowrap;
.panel {
  min-width: 100%;
.fixed {
  position: fixed;
  height: 100vh;
  width: 100%;
  overflow-x: hidden;




let sections = gsap.utils.toArray(".panel");, {
  xPercent: -100 * (sections.length - 1),
  ease: "none",
  scrollTrigger: {
    start: 0,
    end: st => ScrollTrigger.maxScroll(st.scroller),
    scrub: 1,
    snap: 1 / (sections.length - 1),
    // base vertical scrolling on how wide the container is so it feels more natural.