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="smooth-scroll">
  <div class="top-page">
<div class="spacer"></div>


                .top-page {
  top: 30vh;
  padding-top: 10vh;
  background: red;

header {
  width: 100%;
  height: 30vh;
  display: flex;
  align-items: center;
  jusitfy-content : center;
  text-align: center;
  background: black;
  color : white;

h1 {
  width: 100%;

.spacer {
  height: 170vh;



// Using Locomotive Scroll from Locomotive

const locoScroll = new LocomotiveScroll({
  el: document.querySelector(".smooth-scroll"),
  smooth: true
// each time Locomotive Scroll updates, tell ScrollTrigger to update too (sync positioning)
locoScroll.on("scroll", ScrollTrigger.update);

// tell ScrollTrigger to use these proxy methods for the ".smooth-scroll" element since Locomotive Scroll is hijacking things
ScrollTrigger.scrollerProxy(".smooth-scroll", {
  scrollTop(value) {
    return arguments.length ? locoScroll.scrollTo(value, 0, 0) : locoScroll.scroll.instance.scroll.y;
  }, // we don't have to define a scrollLeft because we're only scrolling vertically.
  getBoundingClientRect() {
    return {top: 0, left: 0, width: window.innerWidth, height: window.innerHeight};
  // LocomotiveScroll handles things completely differently on mobile devices - it doesn't even transform the container at all! So to get the correct behavior and avoid jitters, we should pin things with position: fixed on mobile. We sense it by checking to see if there's a transform applied to the container (the LocomotiveScroll-controlled element).
  pinType: document.querySelector(".smooth-scroll").style.transform ? "transform" : "fixed"

let tl1 = gsap.timeline({paused:true})
		y: 0,
		overwrite: 'auto'
		duration: 2,
		y: 200,
		ease: CustomEase.create("custom", "0.5, 0, 0, 1"),
		overwrite: 'auto'

let tl2 = gsap.timeline({paused:true})
	.to("header", {
		scale: 1.2,
		y: 200,
	.set("header", {y: 200,scale: 1,},"hide")
	.to("header", {opacity:1},"start2")
	.to(("header"), { y: 0, duration: 1, ease: "power4.out" }, "start2")

	trigger: ".top-page",
	start: "top-=100 top",
	end: "top+=200 top",
  markers: true,

	onEnter: () => {},
	onLeaveBack: () => {}