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

              
                <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <style>
       
</style>
    <title>Scroll Indicator</title>
</head>
<body>
   
      <h1>Title One
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Tempore architecto hic aperiam voluptas culpa aliquam a odit quae ipsum aspernatur!</p>
      </h1>

      <h2>Title Two
        <p> eius dolore molestias harum velit sit! Magni voluptates placeat fugiat sint debitis illum saepe rem eveniet ipsam? Ad amet, reiciendis fugit optio, eaque aperiam dignissimos itaque natus ducimus voluptatem atque?</p>
      </h2>
      <script>
     
</script>
</body>
</html>
              
            
!

CSS

              
                 body{
            width:100%;
            height:300vh;
            box-sizing: border-box;
            background: rgb(6, 16, 34);
            padding: 0;
            display: flex;
            flex-direction: column;
            margin: 0;
            font-family:Georgia, 'Times New Roman', Times, serif;
        }
  
h1
{
    position: absolute;
    top:100vh;
    opacity: 0;
    height: auto;
    width:40%;
    left:30px;
    transition: 1s;
    color:white;
    padding:20px;
    background: rgba(189, 1, 73, 0.507);
    box-shadow: 0px 0px rgba(255, 255, 255, 0.2);
    -webkit-box-reflect: below 10px linear-gradient(transparent,rgba(0, 0, 0, 0.349));

}
h2{
  padding:20px;
  height: auto;
    width:40%;
  box-shadow: 0px 0px rgba(255, 255, 255, 0.2);
    background: rgba(1, 82, 189, 0.507);
    -webkit-box-reflect: below 10px linear-gradient(transparent,rgba(0, 0, 0, 0.349));
    position: absolute;
    top:200vh;
    color:white;
    overflow: hidden;
    opacity: 0;
    left:30px;
    transition: all 1s ease-out;
    overflow: hidden;
}

.left
{
  left:-60px;
  transition: all 1s ease-out;
  box-shadow: 0px 0px 30 rgba(255, 255, 255, 0.2);
}
.right
{
  left:120px;
  transition: all 1s ease-out;
  box-shadow: 0px 0px 30 rgba(255, 255, 255, 0.2);
}

              
            
!

JS

              
                 // When the user scrolls the page, execute myFunction
      var h1 = document.querySelector('h1');

var h2 = document.querySelector('h2');
window.onscroll = function() {myFunction(h1,"left"),myFunction(h2,"right")};


function myFunction(tag,anim) {
 
var height = window.innerHeight/2;
var tag_height = tag.getBoundingClientRect().top;

  if(tag_height<height)
  {
  tag.style.opacity="1";
 
  tag.classList.remove(anim);

//   alert("got");
  }
  else{
    tag.classList.add(anim);
    tag.style.opacity="0"; 
  }

}

              
            
!
999px

Console