cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="container">
<div id="demo">
  <div contenteditable="">Way to detect overflow event support and use it with graceful degradation.<br/>Works on Chrome, Safari and Firefox.<br/>Now insert some text here to make it `overflow`.<br></div>
</div>
<div id="status"></div>
</div>
<a href="https://github.com/zmmbreeze/useOverflowEvent" target="_top"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
            
          
!
            
              body {
  margin: 0;
}
.container {
  width: 640px;
  margin: 0 auto;
}
#demo {
    margin: 2em 0 0;
    padding: 0.5em;
    height: 80px;
    overflow: auto;
    line-height: 1.5;
    border: 2px solid #CCD1D9;
    border-bottom-width: 1px;
}
#demo div {
    outline: none;
}
#status {
    margin-bottom: 2em;
    padding: 5px 1em;
    color: #967ADC;
    border: 2px solid #CCD1D9;
    border-top: none;
    background: #EAEAEA;
}
            
          
!
            
              useOverflowEvent(function (addOverflowListener) {
  var status = document.getElementById('status');
  status.innerHTML = 'Overflow event ' + (addOverflowListener ? 'supported' : 'not supported');
  if (!addOverflowListener) {
    // browser not support
    return;
  }

  var container = document.getElementById('demo');
  addOverflowListener(container, 'over', function () {
    status.innerHTML = 'overflow';
  });
  addOverflowListener(container, 'under', function () {
    status.innerHTML = 'underflow';
  });
});
            
          
!
999px
Loading ..................

Console