Pen Settings



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


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


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.


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.


                <p>We can use <a href="">IntersectionObserver</a>, to define a <code>callback</code> function that will be fired when an <code>element</code> crosses browser window (or any other chosen element) boundaries.</p>
<p>But a <i>sticky</i> element won't execute <code>callback</code>, as far as it will never cross window boundaries.</p>
<p>Unfortunately, there is no <i>onSticky</i> event, so, in order to detect when our <code>element</code> gets <i>sticky</i>, we should use a workaround: a dummy <code>sentinel</code> element, appended right after our <i>sticky</i> <code>element</code>.</p>
<p>As our <code>sentinel</code> might cross window boundaries, just after our <i>sticky</i> <code>element</code> would have crossed them, <code>sentinel</code> will serves us like a snitch, executing <code>callback</code> by faking an <i>onSticky</i> event.</p>

<p><b>DEMO:</b> please, resize window to allow <b>element</b> to get <i>sticky</i>.</p>

<div class="element">
<div class="sentinel"></div>

<p>More info:</p>
  <li><a href=""></a></li>
  <li><a href=""></a></li>
  <li><a href=""></a></li>


                $space: 1em;

body { margin: 0 }
p    { margin: $space }

.element {
  position: sticky;
  bottom: 0;
  padding: 0 $space;
  color: red;
  &.is-sticky {
    color: green;
    background-color: #fff;
    padding: $space;
    box-shadow: 0px -1px 5px 0px rgba(0,0,0,0.75);


                if (window.IntersectionObserver) {
	var callback = function callback(entries, observer) {
		var element = document.querySelector('.element');

		entries.forEach(function (entry) {
			if (entry.isIntersecting) {
			} else {

	var observer = new IntersectionObserver(callback);
	var sentinel = document.querySelector('.sentinel');