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="fullpage">
  <div class="section">
    <div id="slide1" class="slide">
      <section class="content">
        <h3 class="title">slide 1</h3>
        <p> the problem is within slide 2 & 3, the animation will run the same time. I want it to animate only on the loaded slide, so when the user swipe to slide 3, the animation will run again.
        </p>
      </section>
    </div>
    <div id="slide2" class="slide">
      <section class="content">
        <h3 class="title">slide 2</h3>
        <p> content </p>
      </section>
    </div>
    <div id="slide3" class="slide">
      <section class="content">
        <h3 class="title">slide 3</h3>
        <p> content </p>
      </section>
    </div>
  </div>
</div>

              
            
!

CSS

              
                .slide .title,
.slide p{
  visibility: hidden;
}

.slide:first-child .title,
.slide:first-child p{
  visibility: visible;
}

.content {
  text-align: center;
  max-width: 80%;
  margin: 0 auto;
  padding: 25px 15px;
}

#slide1 {
  background: orange;
}

#slide2 {
  background: cadetblue;
}

#slide3 {
  background: gainsboro;
}

              
            
!

JS

              
                
// Create animations for every slide
var slideAnimations = $(".slide").map(createSlideAnimations);

$("#fullpage").fullpage({
  controlArrows: true,
  slidesNavigation: true,
  slidesNavPosition: "bottom",
  afterSlideLoad: playAnimation,
  onSlideLeave: resetAnimation
});

function createSlideAnimations(index, slideElement) {
    
  var workTitle = $(".title", slideElement);
  var workContent = $("p", slideElement);
  var content = [workTitle, workContent];
  
  TweenLite.set(content, { autoAlpha: 0 });
  
  var tl = new TimelineLite({ paused: true })
    .staggerTo(content, 0.2, {
      autoAlpha: 1,
      ease: Power1.easeIn      
    }, 0.2);
  
  // If this is the first slide, move to timeline progress
  // to the end to make it visible
  if (index === 0) {
    tl.progress(1);
  }
  
  return tl;
}

function resetAnimation(anchorLink, index, slideIndex, direction, nextSlideIndex) {
  slideAnimations[nextSlideIndex].pause(0);
}

function playAnimation(anchorLink, index, slideAnchor, slideIndex) {
  slideAnimations[slideIndex].play();
}



              
            
!
999px

Console