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%;
}
.showing {
  opacity: 1 !important;
  // animation-delay: 1s;
}

h4 {
  text-transform: uppercase;
  text-align: center;
  color: white;
}
p {
  max-width: 300px;
}
.arrows {
  position: relative;
  margin: 90px auto 200px auto;
  div {
    height: 0px;
    width: 0px;
    margin: 5px auto 0;
    display: block;
    vertical-align: baseline;
    position: relative;
    border-top: 35px solid;
    border-bottom: 35px solid;
    border-left: 60px solid;
    border-right: 60px solid;
    &:not(.arrow1) {
      opacity: 0;
      transition: all 3s;
    }
    > * {
      margin-top: -10px;
      margin-right: -100px;
      margin-left: -100px;
    }
    &:before {
      border: 35px solid;
      border-top: 35px solid transparent;
      border-bottom: 35px solid;
      border-left: 60px solid transparent;
      border-right: 60px solid transparent;
      content: "";
      right: -60px;
      top: -105px;
      position: absolute;
      z-index: -1;
    }
    &:after {
      border: 35px solid;
      border-left: 60px solid transparent;
      border-bottom: 60px solid transparent;
      border-right: 60px solid transparent;
      content: "";
      right: -60px;
      top: 35px;
      position: absolute; 
      z-index: -1;
    }
    &.arrow1 {
      background-color: #F0A11F;
      border-color: #f0a11f;
      right: 30px;
      img {
          height: 25px;
          margin-left: -70px;
          padding-left: 8px;;
        }
        &:before {
          border-bottom-color: #F0A11F;
        }
        &:after {
          border-top-color: #F0A11F;
        }
    }
    &.arrow2 {
      border-color: cornflowerblue;
      right: -35px;
      top: 40px;
      &:before {
        border-bottom-color: cornflowerblue;
      }
      &:after {
        border-top-color: cornflowerblue;
      }
    }
    &.arrow3 {
      border-color: steelblue;
      right: 30px;
      top: 80px;
      transition-delay: 2s;
      &:before {
        border-bottom-color: steelblue;
      }
      &:after {
        border-top-color: steelblue;
      }
    }
    &.arrow4 {
      border-color: midnightblue;
      right: -35px;
      top: 120px;
      transition-delay: 4s;
      &:before {
        border-bottom-color: midnightblue;
      }
      &:after {
        border-top-color: midnightblue;
      }
    }
  }

  @media (min-width: 767px) {
    div {
      min-width: 15px;
      display: inline-block;
      border-top: 60px solid;
      border-bottom: 60px solid;
      border-left: 60px solid;
      border-right: 0;
      vertical-align: middle;
      > * {
        margin-top: -12px;
        margin-left: -150px;
      }
      &:before {
        border-top: 60px solid transparent;
        border-bottom: 60px solid transparent !important;
        border-left: 35px solid transparent;
        border-right: 35px solid transparent;
        // content: "";
        right: 75px;
        top: -60px;
        position: absolute;
      }
      &:after {
        border: 35px solid;
        border-top: 60px solid transparent !important;
        border-bottom: 60px solid transparent;
        border-right: 60px solid transparent;
        right: -95px;
        top: -60px;
        position: absolute;
      }
      &.arrow1 {
        background-color: #F0A11F;
        border-color: #f0a11f;
        right: -35px;
        img {
          height: 25px;
          margin-left: -70px;
          padding-left: 8px;;
        }
        &:before {
          border-right-color: #F0A11F;
        }
        &:after {
          border-left-color: #F0A11F;
        }
      }
      &.arrow2 {
        border-color: cornflowerblue;
        top: 65px;
        right: -80px;
        &:before {
          border-right-color: cornflowerblue;
        }
        &:after {
          border-left-color: cornflowerblue;
        }
      }
      &.arrow3 {
        border-color: steelblue;
        right: -125px;
        top: 0;
        &:before {
          border-right-color: steelblue;
        }
        &:after {
          border-left-color: steelblue;
        }
      }
      &.arrow4 {
        border-color: midnightblue;
        top: 65px;
        right: -170px;
        &:before {
          border-right-color: midnightblue;
        }
        &:after {
          border-left-color: midnightblue;
        }
      }
    }
  }
}

              
            
!

JS

              
                jQuery(document).ready(function() {
    jQuery("#degree").appear();
  
    jQuery(document.body).on('appear', '#degree', animate);
  // 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(id).position().top;
//    var targetHeight = jQuery(id).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", "animation-delay":"2s"});
//     }else {
//       jQuery(id + "> div").css("opacity","1");
//     }
//   }
// }

function animate() {
  if (jQuery(window).width() >= 767){
      jQuery("#degree > div").addClass("showing");
      // css({"opacity":"1", "right":"0", "animation-delay":"1s"});
    }else {
      jQuery("#degree > div").css("opacity","1");
    }
}

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


/*
 * jQuery appear plugin
 *
 * Copyright (c) 2012 Andrey Sidorov
 * licensed under MIT license.
 *
 * https://github.com/morr/jquery.appear/
 *
 * Version: 0.3.6
 */
(function ($) {
    var selectors = [];

    var check_binded = false;
    var check_lock = false;
    var defaults = {
        interval: 250,
        force_process: false
    };
    var $window = $(window);

    var $prior_appeared = [];

    function appeared(selector) {
        return $(selector).filter(function () {
            return $(this).is(':appeared');
        });
    }

    function process() {
        check_lock = false;
        for (var index = 0, selectorsLength = selectors.length; index < selectorsLength; index++) {
            var $appeared = appeared(selectors[index]);

            $appeared.trigger('appear', [$appeared]);

            if ($prior_appeared[index]) {
                var $disappeared = $prior_appeared[index].not($appeared);
                $disappeared.trigger('disappear', [$disappeared]);
            }
            $prior_appeared[index] = $appeared;
        }
    }

    function add_selector(selector) {
        selectors.push(selector);
        $prior_appeared.push();
    }

    // "appeared" custom filter
    $.expr[':'].appeared = function (element) {
        var $element = $(element);
        if (!$element.is(':visible')) {
            return false;
        }

        var window_left = $window.scrollLeft();
        var window_top = $window.scrollTop();
        var offset = $element.offset();
        var left = offset.left;
        var top = offset.top;

        if (top + $element.height() >= window_top &&
                top - ($element.data('appear-top-offset') || 0) <= window_top + $window.height() &&
                left + $element.width() >= window_left &&
                left - ($element.data('appear-left-offset') || 0) <= window_left + $window.width()) {
            return true;
        } else {
            return false;
        }
    };

    $.fn.extend({
        // watching for element's appearance in browser viewport
        appear: function (options) {
            var opts = $.extend({}, defaults, options || {});
            var selector = this.selector || this;
            if (!check_binded) {
                var on_check = function () {
                    if (check_lock) {
                        return;
                    }
                    check_lock = true;

                    setTimeout(process, opts.interval);
                };

                $(window).scroll(on_check).resize(on_check);
                check_binded = true;
            }

            if (opts.force_process) {
                setTimeout(process, opts.interval);
            }
            add_selector(selector);
            return $(selector);
        }
    });

    $.extend({
        // force elements's appearance check
        force_appear: function () {
            if (check_binded) {
                process();
                return true;
            }
            return false;
        }
    });
})(function () {
    if (typeof module !== 'undefined') {
        // Node
        return require('jquery');
    } else {
        return jQuery;
    }
}());
              
            
!
999px

Console