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 is required to process package imports. If you need a different preprocessor remove all packages first.

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


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.


                <h1>Demo of Creating jQuery Plugin—Image Slideshow</h1>

<ul id='slideshow'>
  <li><img src='' alt='Placeholder image'></li>
  <li><img src='' alt='Placeholder image'></li>
  <li><img src='' alt='Placeholder image'></li>
  <li><img src='' alt='Placeholder image'></li>
  <li><img src='' alt='Placeholder image'></li>

<p><small>This is a demo by Makzan. Created for the <a href=''>Beginning jQuery</a> course.</small></p>



                /* Slideshow controlling */

/* Theme A */
.theme-a.slideshow li {
  transition: all 0.35s ease-out;
.theme-a.slideshow li.ready-to-show {
  transform: translateX(100%);
  transition: none;
.theme-a.slideshow li.showing {
  transform: translateX(0);
.theme-a.slideshow li.after-show {
  transform: translateX(-100%);

/* Theme B */
.theme-b.slideshow li {
  transition: all 0.65s ease-out;
.theme-b.slideshow li.ready-to-show {
  transform: scale(.9);
  opacity: 0;
  transition: none;
.theme-b.slideshow li.showing {
  transform: scale(1);
  opacity: 1;
.theme-b.slideshow li.after-show {
  transform: scale(1.4);
  opacity: 0;

/* Slideshow layout style */
.slideshow {
  overflow: hidden;  
  width: 500px;
  height: 200px;
  position: relative;
ul.slideshow {
  margin: 0;
  padding: 0;
  list-style: none;
.slideshow li {
  position: absolute;  

/* Not related */
.slideshow {
  border: 3px solid BLACK;
  border-radius: 5px;

body {
  padding: 50px;


                (function($) {
  $.fn.makeSlideshow = function(options) {
    // default settings
    var settings = $.extend({
      theme: 'theme-a',
      interval: 3000,
    }, options );
    var container = $(this);
    // apply theme
    // get all images
    var images = $(this).find('li');

    // make all images in `before` state

    // current index default 0.
    var currentIndex = 0;

    // showing 1 image by default.

    function nextSlide() {
      // move all existing `after` image to ready-to-show state.

      // find the current image and move it to after-show.

      // increase currentIndex by 1. Reset to 0 if the index exceeds count of images.
      currentIndex = (currentIndex + 1 ) % images.length;

      // move next image to current.

    setInterval(nextSlide, settings.interval);  

    return this;

  theme: 'theme-b',
  interval: 1500,