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="bg-green-800 text-white h-screen flex items-center justify-center">
  Some component
<div id="container" class="max-w-5xl mx-auto w-full flex py-20">
  <div class="w-1/2 space-y-16 text-white text-2xl">
    <div class="w-96 h-96 bg-red-500 p-4">1</div>
    <div class="w-96 h-96 bg-red-500 p-4">2</div>
    <div class="w-96 h-96 bg-red-500 p-4">3</div>
    <div class="w-96 h-96 bg-red-500 p-4">4</div>
    <div class="w-96 h-96 bg-red-500 p-4">5</div>
    <div class="w-96 h-96 bg-red-500 p-4">6</div>
    <div class="w-96 h-96 bg-red-500 p-4">7</div>
    <div class="w-96 h-96 bg-red-500 p-4">8</div>
    <div class="w-96 h-96 bg-red-500 p-4">9</div>
  <div id="text" class="w-1/2">
      Text blurb 1
<div class="bg-green-800 text-white h-screen flex items-center justify-center">
  Some other component


                #text {
  max-height: 100vh;



let boxes = gsap.utils.toArray("#container .w-96"),
    container = document.querySelector("#container"),
    text = document.querySelector("#text"),
    padding = gsap.getProperty(container, "paddingTop", "px"),
    // create a ScrollTrigger for each box that we can use to calculate snapping (we'll look at the "start" of each in the onRefresh)
    snapTriggers = => ScrollTrigger.create({
      trigger: box,
      start: "top " + padding + "px"
    snaps = []; // where we'll store the progress value for each box's ScrollTrigger (start)

  trigger: '#container',
  markers: true,
  pin: '#text',
  pinSpacing: false,
  start: "top top",
  end: () => "+=" + (boxes[boxes.length-1].getBoundingClientRect().top - boxes[0].getBoundingClientRect().top),
  onRefresh: self => {
    // re-populate the "snaps" Array with the progress values for where each box hits the target spot.
    let distance = self.end - self.start;
    snapTriggers.forEach((trigger, i) => snaps[i] = (trigger.start - self.start) / distance);
  snap: snaps

// for swapping in the text for each section
boxes.forEach((box, i) => {
    trigger: box,
    start: "top center",
    end: "bottom center",
    onToggle: self => {
      if (self.isActive) {
        // you could animate this in (fade it or whatever)
        text.innerText = "Text blurb " + (i+1);