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 id="smooth-wrapper">
		<div id="smooth-content">
        <div class="section-wrapper">
            <section class="normal"><p>Section 1</p></section>
            <section class="normal"><p>Section 2</p></section>
            <section class="scene"><p>Section 3</p></section>
            <section class="normal"><p>Section 4</p></section>
            <section class="normal"><p>Section 5</p></section>
            <section class="normal"><p>Section 6</p></section>  


                @import url(',400&display=swap');

body { 
  font-family: "Signika Negative", sans-serif; 
  font-weight: 300;
  margin: 0;
  padding: 0 20px;
section {
  height: calc( 30vh - 40px );
  background-color: teal;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
  p {
    font-size: 22px;
  &.scene {
    background-color: aqua;


                gsap.registerPlugin(ScrollTrigger, ScrollSmoother);
let smoother = ScrollSmoother.create();

const sceneTimeline = gsap.timeline();
sceneTimeline.from('section.scene p', { 
  scale: 0,
}).to('section.scene p', { 
  color: 'white'

const st = ScrollTrigger.create({
  trigger: 'section.scene',
  start: 'top 40%',
  end: 'bottom 40%',
  scrub: true,
  pin: '.section-wrapper',
  animation: sceneTimeline,
  markers: true,
  // pinSpacing: false,
  onLeave: (self) => {
    let pinDistance = self.end - self.start, // figure out how far the pinning was so we can adjust the scroll position
        scroll = self.scroll() - pinDistance;
    smoother.paused(true); // pause smooth scrolling because we're messing with the scroll position here and don't want the smoothing to continue from the old position.
    self.kill(true, true); // kill the ScrollTrigger (will also get rid of the pinSpacing)
    sceneTimeline.progress(1); // because reverting it also rewinds the animation, so we should force the playhead to the end.
    self.scroll(scroll); // jump to the adjusted scroll position to make it appear seamless even though the layout shifted from the removal of pinSpacing
    smoother.paused(false); // resume smooth scrolling
    ScrollTrigger.refresh(); // now that we've removed pinSpacing, layout has shifted so let's force a refresh right away.