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.


                <audio id="my-audio" preload="auto">
  <source src="" type="audio/mpeg">
  <source src="" type="audio/ogg">

<div id="played-bar">00</div>
<div id="buffer-bar">00</div>
<div id="control-bar">
   <a href='0'>00</a> <a href='10'>10</a> <a href='20'>20</a> 
   <a href='30'>30</a> <a href='40'>40</a> <a href='50'>50</a> 
   <a href='60'>60</a> <a href='70'>70</a> <a href='80'>80</a> 
   <a href='90'>90</a>




                window.onload = function(){
  var myAudio = document.getElementById('my-audio');
  var controlBar = document.getElementById('control-bar');
  // we add our listeners
  myAudio.addEventListener('timeupdate', updatePlayed, false);
  myAudio.addEventListener('progress', updateBuffered, false);
  function updatePlayed() {
     var played = parseInt(((myAudio.currentTime / myAudio.duration) * 100), 10);
     // gives us a percentage
  function updateBuffered() {
     var loaded = parseInt(((myAudio.buffered.end(0) / myAudio.duration) * 100), 10);
     // gives us a percentage 
  function addBars(amount,element) {
     var bars = "00";
     // since our bars are in increments of 10
     for (i=10; i < 100; i = i + 10) {
        if (i <= amount) {
           bars = bars + " " + i;
     var bar = document.getElementById(element);
     bar.innerHTML = bars;
  controlBar.onclick = setTime;
  function setTime(e) {
    var playPosition ='href'); // from 0 to 90
    myAudio.currentTime = (myAudio.duration * playPosition)/100;;
    return false;