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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <nav class="Nav-menu">
        <a href="/home">Home</a>
        <a href="/bio">Bio</a>
        <a href="/contact">Contact</a>
</nav>
<div class="Sentinel Sentinel--navMenu"></div>
<section>
  <p>
    Cat ipsum dolor sit amet, annoy kitten brother with poking hit you unexpectedly. Fight an alligator and win meowwww yet fooled again thinking the dog likes me intrigued by the shower, or lie on your belly and purr when you are asleep kitty kitty but kick up litter. Chew foot i like cats because they are fat and fluffy lick human with sandpaper tongue and i just saw other cats inside the house and nobody ask me before using my litter box and scratch the postman wake up lick paw wake up owner meow meow or cats secretly make all the worlds muffins. Terrorize the hundred-and-twenty-pound rottweiler and steal his bed, not sorry have a lot of grump in yourself because you can't forget to be grumpy and not be like king grumpy cat and knock dish off table head butt cant eat out of my own dish. Friends are not food chase laser, purrrrrr. Lick butt step on your keyboard while you're gaming and then turn in a circle or roll on the floor purring your whiskers off sun bathe wack the mini furry mouse and lick the plastic bag. Refuse to leave cardboard box terrorize the hundred-and-twenty-pound rottweiler and steal his bed, not sorry going to catch the red dot today going to catch the red dot today. </p>
  <p>Toy mouse squeak roll over. Burrow under covers cough eat from dog's food for knock over christmas tree. Use lap as chair reward the chosen human with a slow blink. Try to jump onto window and fall while scratching at wall. Put butt in owner's face try to jump onto window and fall while scratching at wall your pillow is now my pet bed warm up laptop with butt lick butt fart rainbows until owner yells pee in litter box hiss at cats swat at dog. Shake treat bag fooled again thinking the dog likes me licks paws. Pounce on unsuspecting person. </p>
  <p>
    Dream about hunting birds reward the chosen human with a slow blink refuse to leave cardboard box so meow for spot something, big eyes, big eyes, crouch, shake butt, prepare to pounce licks paws cough hairball on conveniently placed pants. Eat a plant, kill a hand. Eat plants, meow, and throw up because i ate plants and sometimes switches in french and say "miaou" just because well why not, sniff catnip and act crazy so pet right here, no not there, here, no fool, right here that other cat smells funny you should really give me all the treats because i smell the best and omg you finally got the right spot and i love you right now. Claw drapes. Ignore the human until she needs to get up, then climb on her lap and sprawl scratch leg; meow for can opener to feed me. 
  </p>
</section>
              
            
!

CSS

              
                body {
  height: 1000px;
}

.Nav-menu {
    position: sticky;
    top: 15px;
    background-color: white;
    
  
  &.is-sticky {
    box-shadow: 0px 2px 2px 1px rgba(0, 0, 0, .5);
  }
  
  a {
    text-decoration: none;
    font-weight: bold;
    font-size: 1.3em;
  }
}


              
            
!

JS

              
                const navMenu = document.querySelector('.Nav-menu');
const navMenuSentinel = document.querySelector('.Sentinel--navMenu');

const navMenuObserver = new IntersectionObserver((entries, observer) => {
        entries.forEach(entry => {
            if(entry.isIntersecting) {
                navMenu.classList.remove('is-sticky');
            } else {
                navMenu.classList.add('is-sticky');
            }
        })
});
navMenuObserver.observe(navMenuSentinel);
              
            
!
999px

Console