Pen Settings



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


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.


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.


                <div class="area area-1">
  <div class="inside inside-1">
    <div class="content content-2"></div>
    <div class="thing thing-1">Nothing</div>
  <div class="count count-1">0</div>

<div class="area area-2">
  <div class="inside inside-2">
    <div class="content content-2"></div>
    <div class="thing thing-2">Throttled</div>
  <div class="count count-2">0</div>

<div class="area area-3">
  <div class="inside inside-3">
    <div class="content content-3"></div>
    <div class="thing thing-3">Debounced</div>
  <div class="count count-3">0</div>


                * {
  box-sizing: border-box;
body {
  background: #eee;

.area {
  width: 300px;
  height: 200px;
  margin: 20px auto;
  background: white;
  position: relative;

.inside {
  height: 200px;
  position: relative;
  overflow: auto;

.content {
  height: 5000px;

.thing {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  text-align: center;
  background: #f06d06;
  color: white;
  padding: 10px;

.count {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);


                // 1
var inside1 = $(".inside-1");
var thing1 = $(".thing-1");
var count1 = $(".count-1");
inside1.on('scroll', function() {
  thing1.css("top", inside1[0].scrollTop);

// 2 
var inside2 = $(".inside-2");
var thing2 = $(".thing-2");
var count2 = $(".count-2");
inside2.on('scroll', _.throttle(function() {
  thing2.css("top", inside2[0].scrollTop); 
}, 150));

// 3
var inside3 = $(".inside-3");
var thing3 = $(".thing-3");
var count3 = $(".count-3");
inside3.on('scroll', _.debounce(function() {
  thing3.css("top", inside3[0].scrollTop);
}, 100));