Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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

Save Automatically?

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>
  <span class="next"></span>
  <div class="page1 page">
    <div class="slide slide1">1. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas porttitor mattis.</div>
    <div class="slide slide2">2. Praesent a dui eu leo vulputate mollis sed id elit. Clas per conubia nostra, per inceptos himenaeos.</div>
    <div class="slide slide3">3. Sed interdum urna dui. In a suscipit tellus, eget elementum tortor. Nunc porta ullamcorper lobortis.</div>
    <div class="slide slide4">4. Nam porta nibh eu nibh eleifend blandit. In a ullamcorper nunc. Cras dignissim, ante nec elementum</div>
  </div>
  <div class="page2 page">
    <div class="slide slide1">1. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas porttitor mattis.</div>
    <div class="slide slide2">2. Praesent a dui eu leo vulputate mollis sed id elit. Clas per conubia nostra, per inceptos himenaeos.</div>
    <div class="slide slide3">3. Sed interdum urna dui. In a suscipit tellus, eget elementum tortor. Nunc porta ullamcorper lobortis.</div>
    <div class="slide slide4">4. Nam porta nibh eu nibh eleifend blandit. In a ullamcorper nunc. Cras dignissim, ante nec elementum</div>
  </div>
  </div>
  <div class="page3 page">
    <div class="slide slide1">1. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas porttitor mattis.</div>
    <div class="slide slide2">2. Praesent a dui eu leo vulputate mollis sed id elit. Clas per conubia nostra, per inceptos himenaeos.</div>
    <div class="slide slide3">3. Sed interdum urna dui. In a suscipit tellus, eget elementum tortor. Nunc porta ullamcorper lobortis.</div>
    <div class="slide slide4">4. Nam porta nibh eu nibh eleifend blandit. In a ullamcorper nunc. Cras dignissim, ante nec elementum</div>
  </div>
  <div class="page4 page">
    <div class="slide slide1">1. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas porttitor mattis.</div>
    <div class="slide slide2">2. Praesent a dui eu leo vulputate mollis sed id elit. Clas per conubia nostra, per inceptos himenaeos.</div>
    <div class="slide slide3">3. Sed interdum urna dui. In a suscipit tellus, eget elementum tortor. Nunc porta ullamcorper lobortis.</div>
    <div class="slide slide4">4. Nam porta nibh eu nibh eleifend blandit. In a ullamcorper nunc. Cras dignissim, ante nec elementum</div>
  </div>
</body>
              
            
!

CSS

              
                body {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  padding: 0;
  margin: 0;
}
.page {
  width: 75vw;
  height: 100vh;
  margin: 0 auto;
  padding: 0;
  position: relative;
}

.slide {
  position: absolute;
  top: 50%;
  transform: translate(0, -50%);
  width: 90%;
  margin: 0 auto;
  padding: 0;
  font-size: 30px;
  line-height: 37px;
  opacity: 0;
  visibility: hidden;
  text-align: center;
}

.next {
/*   background: transparent; */
  display: block;
  height: 100vh;
  width: 100vw;
  z-index: 1000;
  position: absolute;
  left: 0;
  top: 0;
}
              
            
!

JS

              
                masterTl = new TimelineMax({
  // paused: true
}); 
 
masterTl 
 .addLabel("page1")
 .add(page1Fn())
 .addPause()

 .addLabel("page2")
 .add(page2Fn())
 .addPause()

 .addLabel("page3")
 .add(page3Fn())
 .addPause()

 .addLabel("page4")
 .add(page4Fn());

function page1Fn() {
  var page1Tl = new TimelineMax({
    // paused: true
  });

  page1Tl
   .to($('.page1 .slide1'), 1, {autoAlpha: 1})
   .addPause()

   .to($('.page1 .slide1'), 0.5, {autoAlpha: 0})
   .to($('.page1 .slide2'), 1, {autoAlpha: 1})
   .addPause()

   .to($('.page1 .slide2'), 0.5, {autoAlpha: 0})
   .to($('.page1 .slide3'), 1, {autoAlpha: 1})
   .addPause()

   .to($('.page1 .slide3'), 0.5, {autoAlpha: 0})
   .to($('.page1 .slide4'), 1, {autoAlpha: 1})
  return page1Tl
}

function page2Fn() {
  var page2Tl = new TimelineMax({
    // paused: true
  });

  page2Tl
   .to($('.page2 .slide1'), 1, {autoAlpha: 1})
   .addPause()

   .to($('.page2 .slide1'), 0.5, {autoAlpha: 0})
   .to($('.page2 .slide2'), 1, {autoAlpha: 1})
   .addPause()

   .to($('.page2 .slide2'), 0.5, {autoAlpha: 0})
   .to($('.page2 .slide3'), 1, {autoAlpha: 1})
   .addPause()

   .to($('.page2 .slide3'), 0.5, {autoAlpha: 0})
   .to($('.page2 .slide4'), 1, {autoAlpha: 1})
  return page2Tl
}

function page3Fn() {
  var page3Tl = new TimelineMax({
    // paused: true
  });

  page3Tl
   .to($('.page3 .slide1'), 1, {autoAlpha: 1})
   .addPause()

   .to($('.page3 .slide1'), 0.5, {autoAlpha: 0})
   .to($('.page3 .slide2'), 1, {autoAlpha: 1})
   .addPause()

   .to($('.page3 .slide2'), 0.5, {autoAlpha: 0})
   .to($('.page3 .slide3'), 1, {autoAlpha: 1})
   .addPause()

   .to($('.page3 .slide3'), 0.5, {autoAlpha: 0})
   .to($('.page3 .slide4'), 1, {autoAlpha: 1})
  return page3Tl
}


function page4Fn() {
  var page4Tl = new TimelineMax({
    // paused: true
  });

  page4Tl
   .to($('.page4 .slide1'), 1, {autoAlpha: 1})
   .addPause()

   .to($('.page4 .slide1'), 0.5, {autoAlpha: 0})
   .to($('.page4 .slide2'), 1, {autoAlpha: 1})
   .addPause()

   .to($('.page4 .slide2'), 0.5, {autoAlpha: 0})
   .to($('.page4 .slide3'), 1, {autoAlpha: 1})
   .addPause()

   .to($('.page4 .slide3'), 0.5, {autoAlpha: 0})
   .to($('.page4 .slide4'), 1, {autoAlpha: 1})
  return page4Tl
}

$(".next").click(function() {
  masterTl.play();
  console.log("master played")
  // alert();
})

              
            
!
999px

Console