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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

              
                <article>
  <div>
    <h1>Scroll Down to see Animation</h1>
    <h2>Main page Title</h2>
    <h3>Subheading</h3>
    <p>A random paragraph to give the page height and to enable the testing of scrolling animation of the arrows, which will presumably start out with one and as the user scrolls will appear one at a time, building to the fourth arrow.</p>
    <p>another paragraph to give the page some space to scroll.</p>
    <h3>Subheading 2</h3>
    <p>and another to further our purposes and to make the page a vast space for the use of scrolling</p>
    <p>Still need more space so here is another paragraph and we will make it long by typing several extra words that we don't actually need, but then again we don't actully need any of these paragraphs becasue they are just filled with unimportant words.</p>
    <h3>Subheading 3</h3>
    <p>A random paragraph to give the page height and to enable the testing of scrolling animation of the arrows, which will presumably start out with one and as the user scrolls will appear one at a time, building to the fourth arrow.</p>
    <p>another paragraph to give the page some space to scroll.</p>
    <h3>Subheading 3</h3>
    <p>A random paragraph to give the page height and to enable the testing of scrolling animation of the arrows, which will presumably start out with one and as the user scrolls will appear one at a time, building to the fourth arrow.</p>
    <p>another paragraph to give the page some space to scroll.</p>
  </div>
  <div class="arrows" id="degree">
    <div class="arrow1">
      <img src="https://pathwaysupport.org/cdn/ref/pc-logo2.png" onerror="this.onerror=null;this.src='/Content/images/pc-logo2.png';">
    </div>
    <div class="arrow2">
      <h4>Certificate</h4>
    </div>
    <div class="arrow3">
      <h4>Associate<br>Degree</h4>
    </div>
    <div class="arrow4">
      <h4>Bachelor's<br>Degree</h4>
    </div>
  </div>
  <div>
    <h3>Subheading 4</h3>
    <p>and another to further our purposes and to make the page a vast space for the use of scrolling</p>
    <p>Still need more space so here is another paragraph and we will make it long by typing several extra words that we don't actually need, but then again we don't actully need any of these paragraphs becasue they are just filled with unimportant words.</p>
  </div>
</article>
              
            
!

CSS

              
                article {
  margin: 60px 10%;
}
h4 {
  text-transform: uppercase;
  text-align: center;
  color: white;
}
p {
  max-width: 300px;
}
.arrows {
  position: relative;
  margin: 100px auto;
  div {
    height: 0px;
    width: 0px;
    margin: 5px auto 0;
    display: block;
    vertical-align: baseline;
    position: relative;
    border-bottom: 50px solid;
    border-left: 100px solid;
    border-right: 100px solid;
    transition: all 3s;
    &:not(.arrow1) {
      opacity: 0;
    }
    > * {
      margin-top: 25px;
      margin-right: -100px;
      margin-left: -100px;
    }
    &:after {
      border-top: 50px solid;
      border-bottom: 50px solid transparent;
      border-right: 100px solid transparent;
      border-left: 100px solid transparent;
      content: "";
      height: 0;
      width: 0;
      right: -100px;
      bottom: -150px;
      position: absolute;
      z-index: -1;
    }
    &.arrow1 {
      background-color: #F0A11F;
      border-color: #f0a11f;
      img {
        height: 25px;
        padding-left: 20px;
      }
      &:after {
        border-top-color: #F0A11F;
      }
    }
    &.arrow2 {
      border-color: cornflowerblue;
      border-top: 50px solid transparent;
      &:after {
        border-top-color: cornflowerblue;
      }
    }
    &.arrow3 {
      border-color: steelblue;
      border-top: 50px solid transparent;
      &:after {
        border-top-color: steelblue;
      }
    }
    &.arrow4 {
      border-color: midnightblue;
      border-top: 50px solid transparent;
      &:after {
        border-top-color: midnightblue;
      }
    }
  }

  @media (min-width: 767px) {
    div {
      min-width: 100px;
      display: inline-block;
      border-top: 50px solid;
      border-bottom: 50px solid;
      border-left: 35px solid transparent !important;
      border-right: 0;
      vertical-align: middle;
      > * {
        margin-top: -12px;
        margin-left: -80px;
        padding-left: 10px;
      }
      &:after {
        border: 35px solid;
        border-top: 50px solid transparent !important;
        border-bottom: 50px solid transparent;
        border-right: 50px solid transparent;
        content: "";
        right: -85px;
        top: -50px;
        position: absolute;
        z-index: -1;
      }
      &.arrow1 {
        background-color: #F0A11F;
        border-color: #f0a11f;
        img {
          height: 25px;
          margin-left: -40px;
          padding-left: 8px;;
        }
        &:after {
          border-left-color: #F0A11F;
        }
      }
      &.arrow2 {
        border-color: cornflowerblue;
        right: 50px;
        &:after {
          border-left-color: cornflowerblue;
        }
      }
      &.arrow3 {
        border-color: steelblue;
        right: 200px;
        &:after {
          border-left-color: steelblue;
        }
      }
      &.arrow4 {
        border-color: midnightblue;
        right: 350px;
        &:after {
          border-left-color: midnightblue;
        }
      }
    }
  }
}

              
            
!

JS

              
                jQuery(document).ready(function() {
  jQuery(window).scroll(function() {
    var position = measureScroll();
    arrows("#degree", position);
  });
  // jQuery(window).resize(function() {
  //   location.reload( _.debounce());
  //   console.log("resize happened");
  // });
});

function arrows(id, location) {
  var targetPosition = jQuery('#degree').position().top;
   var targetHeight = jQuery('#degree').outerHeight();
  
  if (location[0] + location[1] + targetHeight >= targetPosition) {
    //change width to breakpoint when moving over
    if (jQuery(window).width() >= 767){
      jQuery(id + "> div").css({"opacity":"1", "right":"0"});
    }else {
      jQuery(id + "> div").css("opacity","1");
    }
  }
}

function measureScroll() {
  var scrollTop = jQuery(document).scrollTop();
   var viewportHeight = jQuery(window).height();
var values = [scrollTop, viewportHeight];
  return values;
  // if (scrollTop + viewportHeight + targetHeight >= targetPosition) {
  //   arrows("#degree");
  // }
  // viewport stretches from scrollTop to (scrollTop + viewportHeight)
}
              
            
!
999px

Console