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.


                <section class="first panel blue">
  <h1>Looped "Scrolling" Section Transitions</h1>
  <div class="scroll-down">Scroll up or down<div class="arrow"></div></div>
<section class="panel red">
  <h1>Hey look, another section</h1>
<section class="panel orange">
  <h1>These sections just keep coming</h1>
<section class="panel purple">
  <h1>Nice transitions though</h1>
<section class="panel green">
  <h1>How about we go back to the start after this?</h1>

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


                html, body {
  height: 100%;
body { 
  font-size: 18px;
  font-weight: 300;
.panel {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;

section:not(.first) {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8);



                let sections = gsap.utils.toArray("section"),
    currentSection = sections[0];

gsap.defaults({overwrite: 'auto', duration: 0.3});

// stretch out the body height according to however many sections there are. 
gsap.set("body", {height: (sections.length * 100) + "%"});

// create a ScrollTrigger for each section
sections.forEach((section, i) => {
    // use dynamic scroll positions based on the window height (offset by half to make it feel natural)
    start: () => (i - 0.5) * innerHeight,
    end: () => (i + 0.5) * innerHeight,
    // when a new section activates (from either direction), set the section accordinglyl.
    onToggle: self => self.isActive && setSection(section)

function setSection(newSection) {
  if (newSection !== currentSection) {, {scale: 0.8, autoAlpha: 0}), {scale: 1, autoAlpha: 1});
    currentSection = newSection;

// handles the infinite part, wrapping around at either end....
  start: 1,
  end: () => ScrollTrigger.maxScroll(window) - 1,
  onLeaveBack: self => self.scroll(ScrollTrigger.maxScroll(window) - 2),
  onLeave: self => self.scroll(2)