Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <ul id="myImageList" class="slideshow">
  <li>
    <img alt="High brown fritillary (Argynnis adippe) on a brown knapweed (Centaurea jacea) flower" src="https://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Argynnis_adippe_auf_Centaurea_jacea_01.jpg/1200px-Argynnis_adippe_auf_Centaurea_jacea_01.jpg">
  </li>
  <li>
    <img alt="U500 Donbas - Amur class floating workshop (Project 304), now command ship. Navy of Ukraine. Sevastopol Bay." src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/36/Donbas_U500_2012_G1.jpg/1200px-Donbas_U500_2012_G1.jpg">
  </li>
  <li>
    <img alt="The church of Saint Metropolitan Peter in Pereslavl, Russia. Roof view from inside." src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/C-petra-0869-roof.jpg/1200px-C-petra-0869-roof.jpg">
  </li>
</ul>
              
            
!

CSS

              
                .slideshow {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

img {
  width: 300px;
}
              
            
!

JS

              
                var myImageList = document.getElementById('myImageList');

var slideshow = function(imageList) {
  var count = imageList.children.length;
  var current = 0;
  var ONE_SECOND = 1000;
  var i;
  var nextSlide;
  
  for (i = 1; i < count; i++) {
    imageList.children[i].style.display = 'none';
  }
  
  nextSlide = function() {
    var next;
    
    if (current + 1 > count - 1) {
      next = 0;
    } else {
      next = current + 1;
    }
    
    imageList.children[current].style.display = 'none';
    imageList.children[next].style.display = 'block';
    
    current = next;
  }
  
  window.setInterval(nextSlide, ONE_SECOND);
}

slideshow(myImageList);
              
            
!
999px

Console