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

              
                <div class="carousel"
   data-flickity='{ "lazyLoad": true }'>
  <div class="carousel-cell">
    <img class="carousel-cell-image" alt="walrus"
      data-flickity-lazyload-src="https://picsum.photos/360/270/?image=1084"
      data-flickity-lazyload-srcset="
        https://picsum.photos/720/540/?image=1084 720w,
        https://picsum.photos/360/270/?image=1084 360w"
      sizes="(min-width: 1024px) 720px, 360px"
      />
  </div>
  <div class="carousel-cell">
    <img class="carousel-cell-image" alt="bokeh"
      data-flickity-lazyload-src="https://picsum.photos/360/270/?image=56"
      data-flickity-lazyload-srcset="
        https://picsum.photos/720/540/?image=56 720w,
        https://picsum.photos/360/270/?image=56 360w"
      sizes="(min-width: 1024px) 720px, 360px"
      />
  </div>
  <div class="carousel-cell">
    <img class="carousel-cell-image" alt="strawberries"
      data-flickity-lazyload-src="https://picsum.photos/360/270/?image=1080"
      data-flickity-lazyload-srcset="
        https://picsum.photos/720/540/?image=1080 720w,
        https://picsum.photos/360/270/?image=1080 360w"
      sizes="(min-width: 1024px) 720px, 360px"
      />
  </div>
  <div class="carousel-cell">
    <img class="carousel-cell-image" alt="wolf"
      data-flickity-lazyload-src="https://picsum.photos/360/270/?image=718"
      data-flickity-lazyload-srcset="
        https://picsum.photos/720/540/?image=718 720w,
        https://picsum.photos/360/270/?image=718 360w"
      sizes="(min-width: 1024px) 720px, 360px"
      />
  </div>
  <div class="carousel-cell">
    <img class="carousel-cell-image" alt="orange tree"
      data-flickity-lazyload-src="https://picsum.photos/360/270/?image=517"
      data-flickity-lazyload-srcset="
        https://picsum.photos/720/540/?image=517 720w,
        https://picsum.photos/360/270/?image=517 360w"
      sizes="(min-width: 1024px) 720px, 360px"
      />
  </div>
  <div class="carousel-cell">
    <img class="carousel-cell-image" alt="tulip"
      data-flickity-lazyload-src="https://picsum.photos/360/270/?image=696"
      data-flickity-lazyload-srcset="
        https://picsum.photos/720/540/?image=696 720w,
        https://picsum.photos/360/270/?image=696 360w"
      sizes="(min-width: 1024px) 720px, 360px"
      />
  </div>
</div>

              
            
!

CSS

              
                /* external css: flickity.css */

* { box-sizing: border-box; }

body { font-family: sans-serif; }

.carousel {
  background: #FAFAFA;
  margin-top: 200px;
}

.carousel-cell {
  width: 66%;
  height: 400px;
  margin-right: 10px;
  background: #333;
}

.carousel-cell-image {
  display: block;
  max-height: 100%;
  margin: 0 auto;
  max-width: 100%;
  opacity: 0;
  -webkit-transition: opacity 0.4s;
          transition: opacity 0.4s;
}

/* fade in lazy loaded image */
.carousel-cell-image.flickity-lazyloaded,
.carousel-cell-image.flickity-lazyerror {
  opacity: 1;
}

              
            
!

JS

              
                // external js: flickity.pkgd.js

              
            
!
999px

Console