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 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


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.


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.


                <div class="Container">

  <div class="Slider">
    <div class="Slide"></div>
    <div class="Slide"></div>
    <div class="Slide"></div>
    <div class="Slide"></div>
    <div class="Slide"></div>
    <div class="Slide"></div>
    <div class="Slide"></div>
  <p class="carousel-status"></p>


                .Container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100vh;
  background: #1A5276;

.carousel-status {
  text-align: center;
  font-size: 2em;
  color: white;

.Slider {
  width: 100vw;
  height: 80vh;

.Slide {
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 5vh 0;
/*   width: 40vh; */
  width: 570px;
/*   height: 40vh; */
  height: 540px;
  font-size: 4rem;
  color: #fff;
  font-weight: 600;
  counter-increment: carousel-cell;

.Slide:before {
  content: counter(carousel-cell);
} {
  z-index: 100;

.Slide:nth-child(0n+1) { 
  background: #D32F2F;
.Slide:nth-child(0n+2) { 
  background: #FFA000; 
.Slide:nth-child(0n+3) { 
  background: #FFD54F; 

.Slide:nth-child(0n+4) { 
  background: #4CAF50; 

.Slide:nth-child(0n+5) { 
  background: #2196F3;

.Slide:nth-child(0n+6) { 
  background: #4A148C; 

.Slide:nth-child(0n+7) { 
  background: #FFF68F; 
.secondprevSlide {
  transform: translateX(1080px)!important;

.thirdprevSlide {
  transform: translateX(1620px)!important;

.hiddenSlide {
  opacity: 0;



                const flkty = new Flickity('.Slider', {
  setGallerySize: false,
  pageDots: false
  // initialIndex: 1

const carouselStatus = document.querySelector('.carousel-status');

const transformer = new FlickityTransformer(flkty, [
  name: 'translateX', // and add a little rotation...
  stops: [
    [-900, 850], // rotate slides to the left
    [0, 0], // they'll be straight at center
    [900, 850] // and rotated to the right

function updateStatus() {
  const counter = flkty.selectedIndex + 1;
  const currentSlide = flkty.selectedIndex;
  const prevSlide = flkty.selectedIndex - 1;
  const secondprevSlide = flkty.selectedIndex - 2;
  const thirdprevSlide = flkty.selectedIndex - 3;
/*Any Slide beyond current slide changes*/ 
$(".Slide:gt("+currentSlide+")").removeClass('thirdprevSlide secondprevSlide hiddenSlide');
/*Current Slide*/
// $(".Slide:eq("+prevSlide+")").removeClass('hiddenSlide');
/*Previous Slide before current*/
$(".Slide:eq("+prevSlide+")").removeClass('thirdprevSlide secondprevSlide hiddenSlide');
/*First Slide before previous == 1080px*/
$(".Slide:eq("+secondprevSlide+")").addClass('secondprevSlide').removeClass('thirdprevSlide hiddenSlide'); 
/*Second Slide before previous == 1620px*/
$(".Slide:eq("+thirdprevSlide+")").addClass('thirdprevSlide').removeClass('secondprevSlide hiddenSlide'); 
/*Any Slide before the third prevSlide will be hidden*/
if (currentSlide >= 4) {
  return i >= 0 && i < thirdprevSlide
    console.log('hit target');
carouselStatus.textContent = counter;


flkty.on( 'select', updateStatus );

//if not current class add this, 1060px

$( ".Slide:eq( 2 )" ).css( "color", "red" );