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="main">
  <div class="left">
    <img src="" id="logo" alt="V Technologies">
  <div class="right">
    <svg version="1.1" id="burger" xmlns="" xmlns:xlink="" x="0px" y="0px"
		viewBox="0 0 200 200" style="enable-background:new 0 0 200 200;" xml:space="preserve">
		<style type="text/css">
		<rect id="burgermiddle" y="86" class="st0" width="200" height="28"/>
		<rect id="burgertop" class="st0" width="200" height="28"/>
		<rect id="burgerbottom" y="172" class="st0" width="200" height="28"/>
  <div class="content">
    <section class="one">Section 1</section>
    <section class="two">Section 2</section>
    <section class="three" id="sectionthree">
      <div id="square"></div>
    <section class="four">Section 4</section>
    <section class="five">Section 5</section>

<div id="menu">
  <a href="#" data-link=".one" class="menulink">Menu Item 1</a>
  <a href="#" data-link=".two" class="menulink">Menu Item 2</a>
  <a href="#" data-link=".three" class="menulink" id="menuitemthree">Menu Item 3</a>
  <a href="#" data-link=".four" class="menulink">Menu Item 4</a>
  <a href="#" data-link=".five" class="menulink">Menu Item 5</a>


                body {width: 100%; height: 100%; padding: 0; margin: 0; background-color: #333;}
#main {position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 999;}
nav {padding: 2em; box-sizing: border-box; width: 100%; position: fixed;}
#logo {height: 3em;}
#burger {height: 3em;}
.left {width: 50%; float: left;}
.right {width: 50%; float: left; text-align: right;}
section {height: 100%; width: 100%; box-sizing: border-box; font-size: 2em; color: #fff; height: 20em; z-index: 1;}
#square {width: 100px; height: 100px; background-color: #0f1146; position: relative; top: 100px;}
.one, .three, .five {background-color: #333;}
.two, .four {background-color: #111;}
#burger:hover {opacity: .6; cursor: pointer;}
#menu {width: 300px; height: 100%; position: absolute; right: 0; top: 0; background-color: #f00; z-index: 0; font-size: 2em; padding: 1em; box-sizing: border-box;}
.menulink {padding: 0; margin: 0;}
a:hover {text-decoration: none;}



gsap.registerPlugin(ScrollTrigger, ScrollToPlugin, ScrollSmoother);

const menuTween = gsap.timeline()
  .to("#main", {x: -300, duration: .5})
  .to("#burgertop", {y: 88, transformOrigin:"50% 50%", rotation: 45, duration: .25}, "<")
  .to("#burgermiddle", {opacity:0, duration: .25}, "<")
  .to("#burgerbottom", {y: -88, transformOrigin:"50% 50%", rotation: -45, duration: .25}, "<")

document.querySelector("#burger").addEventListener("click", (event) => {
  gsap.set("body", {overflow: "hidden"})

// ---------- ScrollTrigger"nav", {
  scrollTrigger: {
    trigger: "nav",
    start: "top",
    scrub: 1,
    //markers: true,
    toggleActions: "restart pause reverse pause",
	backgroundColor: "#0f1146"
});"#square", {
  scrollTrigger: {
    trigger: "#sectionthree",
    start: "top 80%",
    markers: true,
    toggleActions: "restart pause reverse pause"
	ease: "power2.inOut",
	duration: 1,
	x: 200,

gsap.utils.toArray("#menu a").forEach(el => {
  let linkTo = document.querySelector(el.getAttribute("data-link")),
      st = ScrollTrigger.create({trigger: linkTo, start: "top top"}); // create a ScrollTrigger just to track the location of the linkTo element, including pinning, etc.
  el.addEventListener("click", event => {
    event.preventDefault(); // don't let the browser jump to the link
    gsap.set("body", {overflow: "scroll"});, {scrollTo: st.start, overwrite: "auto"});