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 class="main">
  <div class="section section__1"></div>
  <div class="section section__2"></div>
  <div class="section section__3"></div>
  <div class="section section__4"></div>
  <div class="section section__1"></div>
  <div class="section section__2"></div>
  <div class="section section__3"></div>
  <div class="section section__4"></div>
  <div class="section section__1"></div>
  <div class="section section__2"></div>
  <div class="section section__3"></div>
  <div class="section section__4"></div>
  <div class="section section__1"></div>
  <div class="section section__2"></div>
  <div class="section section__3"></div>
  <div class="section section__4"></div>
</div>

<div class="nav">
  <div class="nav__1">
    <ul class="nav__fr">
       <li>Slide1</li>
            <li>Slide2</li>
            <li>Slide3</li>
            <li>Slide4</li>
            <li>Slide5</li>
            <li>Slide1</li>
            <li>Slide2</li>
            <li>Ipsum</li>
            <li>Lorem</li>
            <li>Amet</li>
            <li>Slide1</li>
            <li>Slide2</li>
            <li>Slide3</li>
            <li>Dolor sit</li>
            <li>Slide5</li>
    </ul>
  </div>
    <div class="nav__2">

  <ul class="nav__bc">
       <li>Slide1</li>
            <li>Slide2</li>
            <li>Slide3</li>
            <li>Slide4</li>
            <li>Slide5</li>
            <li>Slide1</li>
            <li>Slide2</li>
            <li>Ipsum</li>
            <li>Lorem</li>
            <li>Amet</li>
            <li>Slide1</li>
            <li>Slide2</li>
            <li>Slide3</li>
            <li>Dolor sit</li>
            <li>Slide5</li>
  </ul>
  </div>
</div>

<div class="line"></div>
              
            
!

CSS

              
                *{
  box-sizing: border-box;
  margin: 0;padding: 0;
}

body{
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.main{
  position: absolute;
  top: 0;left: 0;
  width: 100%;
}
.section{
  height: 100vh;
  width: 100%;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: 50% 50%;
  &__1{
    background-image: url(https://images.unsplash.com/photo-1500462918059-b1a0cb512f1d?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=0e3917e828b7c2502b0041813eff1294&auto=format&fit=crop&w=634&q=80);
  }
  &__2{
    background-image: url(https://images.unsplash.com/photo-1500886834366-f7311927c60d?ixlib=rb-0.3.5&s=ee967641c5015b17fcba0dfb6f73c400&auto=format&fit=crop&w=634&q=80);
  }
  &__3{
    background-image: url(https://images.unsplash.com/photo-1501715865731-cf01f45a1420?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=b5875ccef3704a914200d130718ccbb8&auto=format&fit=crop&w=675&q=80);
  }
  &__4{
    background-image: url(https://images.unsplash.com/photo-1501848055256-c05f5545c9c0?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=0c36f1ae84bcbc88305619a41179e221&auto=format&fit=crop&w=634&q=80);
  }
}


.nav{
  color:#fff;
  font-size: 150px;
  text-align: center;
  position: absolute;
  top: 0;left: 0;
  width: 100%;
  & > div{
    position: absolute;
    top: 0;left: 0;width: 100%;
  }
  li{
    height: 150px;
    line-height:150px;
  }
  &__fr{
    font-family: 'Londrina Outline', cursive;
    left: 2px;
  }
  &__bc{
    font-family: 'Londrina Solid', cursive;

  }
  
  
}

.nav__2{
  transform: skewY(3deg);
}
ul{
    position: absolute;
    top: 0;left: 0;
    width: 100%;
  list-style:none;
  }


.line{
  position: absolute;
  width: 100%;
  height: 10px;
  background: #fff;
  z-index: 20000;
}
              
            
!

JS

              
                
function normalizeWheel(/*object*/ event) /*object*/ {
  var PIXEL_STEP = 10;
var LINE_HEIGHT = 40;
var PAGE_HEIGHT = 800;
  var sX = 0,
    sY = 0, // spinX, spinY
    pX = 0,
    pY = 0; // pixelX, pixelY

  // Legacy
  if ("detail" in event) {
    sY = event.detail;
  }
  if ("wheelDelta" in event) {
    sY = -event.wheelDelta / 120;
  }
  if ("wheelDeltaY" in event) {
    sY = -event.wheelDeltaY / 120;
  }
  if ("wheelDeltaX" in event) {
    sX = -event.wheelDeltaX / 120;
  }

  // side scrolling on FF with DOMMouseScroll
  if ("axis" in event && event.axis === event.HORIZONTAL_AXIS) {
    sX = sY;
    sY = 0;
  }

  pX = sX * PIXEL_STEP;
  pY = sY * PIXEL_STEP;

  if ("deltaY" in event) {
    pY = event.deltaY;
  }
  if ("deltaX" in event) {
    pX = event.deltaX;
  }

  if ((pX || pY) && event.deltaMode) {
    if (event.deltaMode === 1) {
      // delta in LINE units
      pX *= LINE_HEIGHT;
      pY *= LINE_HEIGHT;
    } else {
      // delta in PAGE units
      pX *= PAGE_HEIGHT;
      pY *= PAGE_HEIGHT;
    }
  }

  // Fall-back if spin cannot be determined
  if (pX && !sX) {
    sX = pX < 1 ? -1 : 1;
  }
  if (pY && !sY) {
    sY = pY < 1 ? -1 : 1;
  }

  return {
    spinX: sX,
    spinY: sY,
    pixelX: pX,
    pixelY: pY
  };
}

const getHeight = () => {
  var body = document.body,
    html = document.documentElement;

  var height = Math.max(
    body.scrollHeight,
    body.offsetHeight,
    html.clientHeight,
    html.scrollHeight,
    html.offsetHeight
  );
  return height;
};
let t1 = TweenLite;
let curScroll = 0;
const lineHeight = 150;
let fullHeight = getHeight();
let mainH = $(".main").height();
let wH = window.innerHeight;
let width = $(window).width();
let isScrolling = false;
let lastScroll = 0;
let lastTime = 0;
let topp = (wH - lineHeight) / 2;
let factor =  $(window).height()/ lineHeight;
let windowHeight = $(window).height();
let maxScroll = (fullHeight - windowHeight)/factor;
let clip = `rect(${topp}px,${width}px,${topp + lineHeight}px,0)`
$(".nav ul").css("top", `${topp}px`);
$(".nav__2").css('clip',clip)

//     clip: rect(298px,1000px,471px,0);
// }
document.addEventListener("wheel", function(e) {
  if (!isScrolling) isScrolling = true;
  const norm = normalizeWheel(e);
  curScroll += norm.spinY * 50;
  if (curScroll > maxScroll) curScroll = maxScroll;
  if (curScroll <= 0) curScroll = 0;
  t1.to(".main", 0.5, {
    y: -curScroll*factor,
    overflow: 5,
    onUpdate: e => {
      TweenLite.to('.nav ul',.2,{
        y:-curScroll,
        overflow:5
      })
    },
    onComplete: e => {
      isScrolling = false;
      goToClosest();
    }
  });
});




function goToClosest(){
  const closest = Math.round((curScroll / lineHeight));
  goTo(closest);
}


function goTo(n){
  curScroll = n*lineHeight;
   t1.to(".main", 0.5, {
    y: -curScroll*factor,
    overflow: 5,
    onComplete: e => {
      isScrolling = false;
    }
  });
  
}
function Velocity(e) {
  if (isScrolling) {
    let speed = (curScroll - lastScroll) / (e - lastTime);
    if (speed < -5) speed = -5;
    if (speed > 5) speed = 5;
    TweenLite.to("li", 1, {
      skewY: -speed * 20
    });
    lastScroll = curScroll;
    lastTime = e;
  }
  window.requestAnimationFrame(Velocity);
}

Velocity();

              
            
!
999px

Console