cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


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.

              <h1>Flickity - media query options, jQuery</h1>

<p>Prev/next buttons enabled at 768px. Draggable disabled at 1200px. Media query options are set only on initialization, not after resize.</p>

<div class="carousel">
  <div class="carousel-cell"></div>
  <div class="carousel-cell"></div>
  <div class="carousel-cell"></div>
  <div class="carousel-cell"></div>
  <div class="carousel-cell"></div>

              /* external css: flickity.css */

* { box-sizing: border-box; }

body { font-family: sans-serif; }

.carousel {
  background: #EEE;

.carousel-cell {
  width: 100%;
  height: 200px;
  margin-right: 10px;
  background: #8C8;
  border-radius: 5px;
  counter-increment: carousel-cell;

@media screen and ( min-width: 768px ) {
  /* half-width cells for larger devices */
  .carousel-cell {
    height: 400px;
    width: 50%;

/* cell number */
.carousel-cell:before {
  display: block;
  text-align: center;
  content: counter(carousel-cell);
  line-height: 200px;
  font-size: 80px;
  color: white;

              // external js: flickity.pkgd.js

// Flickity options, defaults
var options = {
  prevNextButtons: false

// enable prev/next buttons at 768px
if ( matchMedia('screen and (min-width: 768px)').matches ) {
  options.prevNextButtons = true;

// disable draggable at 1200px
if ( matchMedia('screen and (min-width: 1200px)').matches ) {
  options.draggable = false;

$('.carousel').flickity( options );

Loading ..................