Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <div id="nav" class="nav">
  <a data-menuanchor="p1" class="menu__anchor" href="#p1"></a>
  <a data-menuanchor="p2" class="menu__anchor" href="#p2"></a>
  <a data-menuanchor="p3" class="menu__anchor" href="#p3"></a>
</div>

<div id='fullpage' class="fullpage">
  <div class='section pageOne active'>
    <h1 class="heading">Page One</h1>
  </div>
  <div class='section pageTwo'>
    <h1 class="heading">Page Two</h1>
  </div>
  <div class='section pageThree'>
    <h1 class="heading">Page Three</h1>
  </div>
</div>




              
            
!

CSS

              
                @mixin center ($align-items, $justify-content, $flex-direction) {
  display: flex;
  align-items: $align-items;
  justify-content: $justify-content;
  flex-direction: $flex-direction;
}


body {
  user-select: none;
  margin: 0;
}

.section {
  height: 100vh;
  width: 100vw;
  @include center(center, center, row);
}

.menu__anchor {
  width: 16px;
  height: 16px;
  background: #dfdfdf;
  margin: 8px 0px 8px 0px;
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 
    0 2px 2px 0 rgba(0, 0, 0, 0.14), 
    0 1px 5px 0 rgba(0, 0, 0, 0.12), 
    0 3px 1px -2px rgba(0, 0, 0, 0.2);
}

.nav {
  z-index: 1;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  right: 40px;
  height: 300px;
  @include center(center, center, column);
}


.pageOne {
  background: grey;
}

.pageTwo {
  background: #191A1E;
}

.pageThree {
  background: grey;
}

.pageFour {
  background: #191A1E;
}

.pageFive {
  background: grey;
}


ul {
  list-style: none;
}

h1 {
  color: white;
  padding-left: 50px;
}

              
            
!

JS

              
                // Grab pagination dots
var anchorLink = $(".menu__anchor");

// Create animation for each element
var animations = anchorLink.map(createAnimation);

function createAnimation(i, element) {
  
  var tween = TweenLite.to(element, 0.34, {backgroundColor:"#241FF3"}).reverse();
  // Return a function to toggle the reversed state
  return function(target) {
    var reversed = element !== target ? true : !tween.reversed();
    tween.reversed(reversed);
  }
}

function playAnimation(event) {
  // Cycle through list of animations, toggling reversed state
  animations.each(function(i, animate) {
    animate(event.target);
  });
}

anchorLink.click(playAnimation);



// init fullpage
$(function(){
  $('#fullpage').fullpage({
    licenseKey: 'OPEN-SOURCE-GPLV3-LICENSE',
    scrollingSpeed: 1050,
    anchors: ['p1', 'p2', 'p3'],
    menu: '#nav',
    scrollOverflow: false,
    v2compatible: true,

    afterLoad: function(anchorLink, index){
      var loadedSection = $(this);

      if (index == 1) {
        console.log('1 in');
      }

      if (index == 2) {
        console.log('2 in');
      }

      if (index == 3) {
        console.log('3 in');
      }
    },


    // On leave events
    onLeave: function(index, nextIndex, direction){

      if (index == 1) {
        console.log('1 out');
      }

      if (index == 2) {
        console.log('2 out');
      }

      if (index == 3) {
        console.log('3 out');
      }
    }
  });
 });

              
            
!
999px

Console