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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

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

Packages

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.

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

              
                <p>For usage code, see:<a href="https://codepen.io/dipscom/pen/yOpjBW" target="_blank"> This pen</a></p>

              
            
!

CSS

              
                /* **************************************** */
/* Default CSS styles being imported from:
/* https://codepen.io/dipscom/pen/RWXPBB
/* **************************************** */
p {
  margin: 10px;
}
              
            
!

JS

              
                var ImageLoader = function(path, dbug) {
  "use strict";
  if(dbug) console.log("[IMAGE_LOADER] Init");
  // Total count of images to load
  var count = 0;

  this.load = function(parent, names, extension, className, id) {
    // Grab the html tag based on the string provided using its id or tag name
    var container = document.getElementById(parent) || document.querySelector(parent);
    // For each image name in the names array
    names.forEach( function(name) {
      // Append the image created into the html container tag given
      container.appendChild(createImage(name, extension, path, className, id)) 
    })
    
  };

  function createImage(name, extension, path, className, id) {
    if(dbug) console.log("[IMAGE_LOADER] Image " + name);
    // Add one to the count of images loading
    count++;
    // Create the element tag
    var image = document.createElement("img");
    // If a path was provided, use it
    image.src = (path ? path + name + extension : name + extension)
    // If an id name was provided, use it - Otherwise, use the original filename
    image.id = (id ? id : name);
    // If a class name was provided, use it
    if(className) image.className = className;

    image.onload = countReady;

    return image;
  }

  function countReady() {
    // Once loaded
    // Subtract one from the count of images loading
    count--;
    // When the count reaches zero
    if( count === 0 ) {
      // All images have loaded
      // Create the event to dispatch the news
      var event = document.createEvent('Event');
      event.initEvent("IMAGES_LOADED", true, false);
      window.dispatchEvent(event);
    }
  }
};
              
            
!
999px

Console