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.


    <li id="#slide1nav"><a>slide 1</a></li>
    <li id="#slide2nav"><a>slide 2</a></li>
    <li id="#slide3nav"><a>slide 3</a></li>
    <li id="#slide4nav"><a>slide 4</a></li>

<div class="slide-container">
    <section id="slide1" class="slide slide1 scrollMajicFix">
        <div class="module-background">
          <h1 class="text1">Slide 1</h1>
    <section id="slide2" class="slide slide2 scrollMajicFix">
        <div class="module-background">
          <h1 class="text2">Slide 2</h1>
    <section id="slide3" class="slide slide3">
        <div class="module-background">
          <h1 class="text3">Slide 3.</h1>
    <section id="slide4" class="slide slide4">
      <div class="module-background">
        <h1 class="text4">Slide 4</h1>




                * {
    margin: 0;
    padding: 0;

.scrollMajicFix{top:0 !important}

nav {
  position: fixed;
  top: 20px;
  width: 50%;
  z-index: 999;
  left: 50%;
  transform: translate(-50%, 0)

ul {
  display: flex;
  justify-content: space-between;

li {
  list-style: none;
  background-color: white;

li a {
  padding: 20px;

    width: 100%;
    height: 100vh;
    margin: 0 auto;
    position: relative;

.module-background {
    display: flex;
    align-items: center; 
    justify-content: center;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;

.module-background h1 {
    color: white;

.slide1 .module-background {
    background-color: green;

.slide2  .module-background {
    background-color: blue;

.slide3  .module-background {
    background-color: orange;

.slide4  .module-background {
    background-color: brown;


    var ctrl = new ScrollMagic.Controller({   
    // This each sets the animation
    $('.slide').each(function(index,element) {  
          ////////// scroll up //////////

          new ScrollMagic.Scene({
              triggerHook: 0,
              triggerElement: this,
              offset:-50 // small offset added to prevent overscrolling accidentally triggering
          .on('leave', function () {
      , .5, {scrollTo:{y:$(window).height() * (index-1), autoKill:false},ease: Linear.easeNone})
          .addTo(ctrl);  // scene end

          //////////scroll down //////////

           new ScrollMagic.Scene({
                triggerElement: this,
                triggerHook: 0,
                offset:50 // small offset added to prevent overscrolling accidentally triggering
            .on('enter', function () {
       , .5, {scrollTo:{y:$(window).height() * (index+1), autoKill:false},ease: Linear.easeNone});   
            .addTo(ctrl); // scene end
            ////////// Main Nav Click transition //////////
            //slide 1 link
            var slide1Nav = document.getElementById("#slide1nav")
            slide1Nav.addEventListener('click', event => {

                var slide1NavMove = new TimelineMax()

              , 1, {scrollTo:"#slide1"});

              //slide 2 link
              var slide2Nav = document.getElementById("#slide2nav")

              slide2Nav.addEventListener('click', event => {

                  var slide2NavMove = new TimelineMax()

                , 1, {scrollTo:"#slide2"});

              //slide 3 link
              var slide3Nav = document.getElementById("#slide3nav")

              slide3Nav.addEventListener('click', event => {

                  var slide3NavMove = new TimelineMax()

                , 1, {scrollTo:"#slide3"});

                //slide 4 link
                var slide4Nav = document.getElementById("#slide4nav")

                slide4Nav.addEventListener('click', event => {

                    var slide4NavMove = new TimelineMax()

                  , 1, {scrollTo:"#slide4"});

    }); //slide each

/// If clicked
var elementIsClicked = false;
function clickHandler(){
  elementIsClicked = true;

var element = document.getElementById('#slide2nav');
element.addEventListener('click', clickHandler);

function clickHandler(){
        console.log('Clicked'); ///works
    } else {
        console.log('Not'); ///Not working - this is where I'd want to put my scrollmagic stuff.