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

              
                <body>


	<nav>
		<ul>
			<li><span id="#slide-1" class="slide-1 active"></span></li>
			<li><span id="#slide-2" class="slide-2"></span></li>
			<li><span id="#slide-3" class="slide-3"></span></li>
			<li><span id="#slide-4" class="slide-4"></span></li>
			<li><span id="#slide-5" class="slide-5"></span></li>
		</ul>
	</nav>

  <svg  class="go go-next" width="32" height="55">
    <polyline points="3 3 30 28 3 53"></polyline>
  </svg>

  <svg  class="go go-prev" width="32" height="55">
    <polyline points="28 3 3 28 28 53"></polyline>
  </svg> 


<div class="slides-container">
  
	<div class="slide slide01 active" id="slide-1">
		<h1>ONE</h1>
	</div>

	<div class="slide slide02" id="slide-2">
		<h1>TWO</h1>
	</div>

  <div class="slide slide03" id="slide-3">
		<h1>THREE</h1>
	</div>

  <div class="slide slide04" id="slide-4">
	  <h1>FOUR</h1>
  </div>

  <div class="slide slide05" id="slide-5">
		<h1>THE END</h1>
  </div>
</div>
    

   
  </body>
              
            
!

CSS

              
                body, div, p {
  margin: 0;
  padding: 0;
  font-family:sans-serif;
}
svg {
  stroke: #636363;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  z-index:12;
}
.go-prev, .go-next {
  position:absolute;
  cursor: pointer;
  top:50%;
}
.go-next {
  left:calc(100% - 32px)
}
h1 {
  position:absolute;
  top:50%;
  left:50%;
  font-weight: 800;
  font-size: 10vw;
  margin: 0;
}
nav {
  position: absolute;
  bottom: 0%;
  left: 50%;
  width: 240px;
  z-index: 100;
  visibility: hidden;
}

nav ul {
  margin: 0;
  padding: 0;
}

nav ul li {
  position: relative;
  display: block;
  width: 14px;
  height: 13px;
  margin: 7px 2px 2px 40px;
  background-color: transparent !important;
  float: left;
}

nav ul li:first-child {
  margin-left: 0;
}


nav span {
  border-radius: 50%;
  position: absolute;
  z-index: 1;
  height: 4px;
  width: 4px;
  border: 0;
  background: black;
  left: 50%;
  top: 50%;
  margin: -2px 0 0 -2px;
  -webkit-transition: all 0.1s ease-in-out;
  -moz-transition: all 0.1s ease-in-out;
  -o-transition: all 0.1s ease-in-out;
  transition: all 0.1s ease-in-out;
}
nav li span.active {
    height: 16px;
    width: 16px;
    margin: -9px 0 0 -9px;
    border-radius: 100%;
}
 ul li:hover  span {
    height: 20px;
    width: 20px;
    margin: -13px 0 0 -9px;
    border-radius: 100%;
}


.slides-container {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 10;
}

.slide {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.slide01 {
    background-color: grey;
}

.slide02 {
    background-color: #45959b;
}

.slide03 {
    background-color: #778899;
}

.slide04 {
    color: #FFFFFF;
    background-color: #ff0000;
}
.slide05 {
    color: #FFFFFF;
    background-color: #413257;
}



	

              
            
!

JS

              
                
//  =============  xxxxx  ==========================	

TweenMax.set(".centered, nav, h1", {autoAlpha: 1, xPercent:-50, yPercent:-50, force3D:true});	
TweenMax.set(".go", {autoAlpha: 1, yPercent:-50});	

//Forked from [Chrysto](http://codepen.io/bassta/)'s Pen [Fullscreen slides with TweenLite, CSSPlugin and ScrollToPlugin](http://codepen.io/bassta/pen/kDvmC/).  Optimized with the help of Blake Owen

  //First the variables our app is going to use need to be declared

  //References to DOM elements
  var $window = $(window);
  var $document = $(document);
  
  var $navButtons = $("nav span");
  var $navGoPrev = $(".go-prev");
  var $navGoNext = $(".go-next");
  var $slidesContainer = $(".slides-container");
  var $allSlides = $(".slide");
  var $currentSlide = $allSlides.first();
  var slideControl = $("nav a")


  //Animating flag - is our app animating
  var isAnimating = false;

  //The height of the window
  var pageHeight = $window.innerHeight();

  //Key codes for up and down arrows on keyboard. We'll be using this to navigate change slides using the keyboard
  var keyCodes = {
    UP  : 38,
    DOWN: 40
  };

// individual animations per slide
var currentIndex = 0;

var timeline1 = new TimelineMax()
.set('.go-prev',{autoAlpha:0}) 
.from('.slide01 h1',1,{rotationX:'-90',  transformOrigin:'center bottom'})
.reverse();


var timeline2 = new TimelineMax()
.from('.slide02 h1',0.1,{y:-1500})   
.reverse();


var timeline3 = new TimelineMax()
//.set('.slide03 h1',{x:-200})
.from('.slide03 h1',0.1,{x:-1500})   
.reverse();    


var timeline4 = new TimelineMax()
.from('.slide04 h1',0.1,{y:1000})   
.reverse();



var timeline5 = new TimelineMax()
.set('.go-next',{autoAlpha:0})  // always in last slide / timeline !!
.from('.slide05 h1',0.1,{y:-1000})

.reverse();

//every timeline has to be listed in this array here !!!
var timelines = [timeline1, timeline2, timeline3, timeline4, timeline5];
  
  //Going to the first slide
  goToSlide($currentSlide);
  //TweenLite.set($currentSlide, {className: "+=active"});

  /*
	*   Adding event listeners
	* */

	$window.on("resize", onResize).resize();
	$window.on("mousewheel DOMMouseScroll", onMouseWheel);
	$document.on("keydown", onKeyDown);
	$navButtons.on("click", onNavButtonClick);
	$navGoPrev.on("click", goToPrevSlide);
	$navGoNext.on("click", goToNextSlide);
	



  /* == Internal functions == */


  /*  When a button is clicked - first get the button href, and then slide to the container, if there's such a container */

  function onNavButtonClick(event)
  {
    //The clicked button
    var $button = $(this);

    //The slide the button points to
    var $slide = $($button.attr("id"));

    //If the slide exists, we go to it
    if($slide.length)
    {
      goToSlide($slide);
      event.preventDefault();
    }
  }

  /*  Getting the pressed key. Only if it's up or down arrow, we go to prev or next slide and prevent default behaviour */

  function onKeyDown(event)
  {

    var PRESSED_KEY = event.keyCode;

    if(PRESSED_KEY == keyCodes.UP)
    {
      goToPrevSlide();
      event.preventDefault();
    }
    else if(PRESSED_KEY == keyCodes.DOWN)
    {
      goToNextSlide();
      event.preventDefault();
    }

  }

  /*
	*   When user scrolls with the mouse, we have to change slides
	* */
  function onMouseWheel(event)
  {
    //Normalize event wheel delta
    var delta = event.originalEvent.wheelDelta / 30 || -event.originalEvent.detail;

    //If the user scrolled up, it goes to previous slide, otherwise - to next slide
    if(delta < -1)
    {
      goToNextSlide();
    }
    else if(delta > 1)
    {
      goToPrevSlide();
    }
    event.preventDefault();
  }

  /*
	*   If there's a previous slide, slide to it
	* */
  function goToPrevSlide()
  {
    if($currentSlide.prev().length)
    {
      goToSlide($currentSlide.prev());
    }
  }

  /*
	*   If there's a next slide, slide to it
	* */
  function goToNextSlide()
  {
    if($currentSlide.next().length)
    {
      goToSlide($currentSlide.next());
    }
  }


  /*
	*   Actual transition between slides
	* */
  function goToSlide($slide)
  {
    //If the slides are not changing and there's such a slide
    if(!isAnimating && $slide.length)
    {
      //setting animating flag to true
      isAnimating = true;
      $currentSlide = $slide;
      currentID = $currentSlide.attr('id');
      NextSlide = $currentSlide.next()           

      //Sliding to current slide
      TweenLite.to($slidesContainer, 1, {scrollTo: {y: pageHeight * $currentSlide.index() }, onComplete: onSlideChangeEnd, onCompleteScope: this});

      //Definig slide status
      TweenLite.to($allSlides.filter(".active"), 0.1, {className: "-=active"});
      TweenLite.to($allSlides.filter($currentSlide), 0.1, {className: "+=active"});

      //Animating menu items
      TweenLite.to($navButtons.filter(".active"), 0.5, {className: "-=active"});
      TweenLite.to($navButtons.filter("." + currentID), 0.5, {className: "+=active"});

    }
  }

  /*
	*   Once the sliding is finished, we need to restore "isAnimating" flag.
	*   You can also do other things in this function, such as changing page title
	* */
  function onSlideChangeEnd() {
    isAnimating = false;
    
    // Reverse the timeline for the previous slide
    timelines[currentIndex].reversed(true).progress(0);
    
    // Change the index
    currentIndex = $currentSlide.index();
    
    // Play the timeline for the current slide
    timelines[currentIndex].reversed(false);
  }

  /*
	*   When user resize it's browser we need to know the new height, so we can properly align the current slide
	* */
  function onResize(event)
  {

    //This will give us the new height of the window
    var newPageHeight = $window.innerHeight();

    /*
		*   If the new height is different from the old height ( the browser is resized vertically ), the slides are resized
		* */
    if(pageHeight !== newPageHeight)
    {
      pageHeight = newPageHeight;

      //This can be done via CSS only, but fails into some old browsers, so I prefer to set height via JS
      TweenLite.set([$slidesContainer, $allSlides], {height: pageHeight + "px"});

      //The current slide should be always on the top
      TweenLite.set($slidesContainer, {scrollTo: {y: pageHeight * $currentSlide.index() }});
    }

  }

              
            
!
999px

Console