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="wrap">
  
  
<div class="info row">
  <div class="col-12">
  <h1>Horizontal Carousels</h1>
  <p>Just hover the boxes below</p>
  <p>... testing stuff for a personal project of mine, press the button to debug polygon ...</p>
  <div>
</div>

<!--<hr />-->
    
<div class="content row">
  
  <div class="col-03">
    
    <div class="container m-square">
      <div class="wrapper">
        <div class="module">
          <div class="label"><span>1</span></div>
          <div class="label"><span>2</span></div>
          <div class="label"><span>3</span></div>
          <div class="label"><span>4</span></div>
        </div>
      </div>
    </div>
    <h2>Wrapped Square</h2>
    <button>toggle debug</button>
    
  </div> <!--col END-->
  <div class="col-03">
  
    <div class="container m-hexagone">
      <div class="wrapper">
        <div class="module">
          <div class="label"><span>1</span></div>
          <div class="label"><span>2</span></div>
          <div class="label"><span>3</span></div>
          <div class="label"><span>4</span></div>
          <div class="label"><span>5</span></div>
          <div class="label"><span>6</span></div>
        </div>
      </div>
    </div>
    <h2>Wrapped Hexagon</h2>
    <button>toggle debug</button>
    
  </div> <!--col END-->
  
  <div class="col-03">
    
    <div class="container m-square no-wrap">
      <div class="wrapper">
        <div class="module">
          <div class="label"><span>1</span></div>
          <div class="label"><span>2</span></div>
          <div class="label"><span>3</span></div>
          <div class="label"><span>4</span></div>
        </div>
      </div>
    </div>
    <h2>Unwrapped Square</h2>
    <button>toggle debug</button>
    
  </div> <!--col END-->
  <div class="col-03">

    <div class="container m-hexagone no-wrap">
      <div class="wrapper">
        <div class="module">
          <div class="label"><span>1</span></div>
          <div class="label"><span>2</span></div>
          <div class="label"><span>3</span></div>
          <div class="label"><span>4</span></div>
          <div class="label"><span>5</span></div>
          <div class="label"><span>6</span></div>
        </div>
      </div>
    </div>    
    <h2>Unwrapped Hexagon</h2>
    <button>toggle debug</button>
    
  </div> <!--col END-->
  
</div> <!--row END-->
    

    
  
<hr />
    
    
    
    
</div> <!--wrap END-->
              
            
!

CSS

              
                /*
 * VARIABLES 
 *
 */

$dark: #606060;
$darker: #3b3b3b;
$light: #d6d6d6;
$black: #333;
$blue: #1EAEDB;
$green: #a5d4ab;
$red: #fa8e8d;





/*
 * SCSS EXTEND CLASSES 
 *
 */

.gradient {
  background: rgba(237,237,237,1);
  background: -moz-linear-gradient(-45deg, rgba(237,237,237,1) 0%, rgba(255,255,255,1) 100%);
  background: -webkit-gradient(left top, right bottom, color-stop(0%, rgba(237,237,237,1)), color-stop(100%, rgba(255,255,255,1)));
  background: -webkit-linear-gradient(-45deg, rgba(237,237,237,1) 0%, rgba(255,255,255,1) 100%);
  background: -o-linear-gradient(-45deg, rgba(237,237,237,1) 0%, rgba(255,255,255,1) 100%);
  background: -ms-linear-gradient(-45deg, rgba(237,237,237,1) 0%, rgba(255,255,255,1) 100%);
  background: linear-gradient(135deg, rgba(237,237,237,1) 0%, rgba(255,255,255,1) 100%);
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ededed', endColorstr='#ffffff', GradientType=1 );
}





/*
 * RESET STYLES 
 *
 */

html *, html *:after, html *:before {
  box-sizing: border-box;
}

hr {
  margin: 2em auto;
  border: none;
  height: 0px;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  border-top: 1px solid rgba(0,0,0,0.8);
}

body {
  font-family: 'Raleway', Helvetica, Arial, sans-serif;
  font-weight: 400;
  font-size: 2em;
  background-color: $darker;
  color: $dark;
  text-align: center;
}


.wrap {
  margin: 0 auto;
  max-width: 900px;
  min-width: 720px;
}


.content {
  margin: 0.5em auto;
}


h1 {
  margin: 0.2em 0 0 0;
  color: $green;
  letter-spacing: -0.07em;
  font-weight: 900;
}


h2 {
  width: 100px;
  margin: 1em auto;
  color: $green;
  letter-spacing: -0.07em;
  font-weight: 400;
  font-size: 0.6em;
  color: $red;
}


p {
  margin: 0;
  color: $blue;
  & ~ p {
    font-size: 0.6em;
    color: $dark;
  }
}





/*
 * HELPER CLASSES 
 */

.row {
    padding: 0;
    margin: 0 auto;
    
    & {
        *zoom: 1;
    }
  
    &:before,
    &:after {
        content: "";
        display: table;
    }
  
    &:after {
        clear: both;
    }
}


[class*='col-'] {
    float: left;
    position: relative;
}


.col-01 { width: 8.333333333%;  }
.col-02 { width: 16.66666667%;  }
.col-03 { width: 25%;           }
.col-04 { width: 33.33333333%;  }
.col-05 { width: 41.66666666%;  }
.col-06 { width: 50%;           }
.col-07 { width: 58.33333333%;  }
.col-08 { width: 66.66666666%;  }
.col-09 { width: 75%;           }
.col-10 { width: 83.333333333%; }
.col-11 { width: 91.66666666%;  }
.col-12 { width: 100%;          }


.zoom {
  transform: scale(3) translateY(-15px);
}





/*
 * DEFAULT CAROUSELS CLASSES 
 */

.container {
  position: relative;
  border: 2px solid transparent;
  border-radius: 2px;
  margin: 1em auto;
  @extend .gradient;
  
  &.m-square {
    width: 150px;
    height: 150px;

    .label {
      width: 120px;
      left: -60px; margin-left: 50%;
      line-height: 150px;
      font-weight: 600;
    }
  }
  
  &.m-hexagone {
    width: 150px;
    height: 150px;
    
    .label {
      width: 76px;
      height: 150px;
      left: -38px; margin-left: 50%;
      line-height: 150px;
      font-weight: 600;
    }
  }
}


.wrapper {
  position: relative;
	width: 100%;
	height: 100%;
  overflow: hidden;
  transition: transform .5s ease;
}


.module {
	position: absolute;
	width: 100%;
	height: 100%;
  perspective: 0;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(.18,1.48,.61,1.03);
}


.label {
    position: absolute;
    color: $darker;
    text-align: center;
    backface-visibility: hidden;
    @extend .gradient;

    // Debug
    /*border: 1px solid $red;
    backface-visibility: visible;*/
}


.m-square .module {

  .label:nth-child(1) {
    transform: translateZ(60px);
  }
  .label:nth-child(2) {
    transform: rotateY(-270deg) translateZ(60px);
  }
  .label:nth-child(3) {
    transform: rotateY(-180deg) translateZ(60px);
  }
  .label:nth-child(4) { 
    transform: rotateY(-90deg) translateZ(60px);
  }
}


.m-hexagone .module {

  .label:nth-child(1) {
    transform: translateZ(65px);
  }
  .label:nth-child(2) {
    transform: rotateY(-300deg) translateZ(65px);
  }
  .label:nth-child(3) {
    transform: rotateY(-240deg) translateZ(65px);
  }
  .label:nth-child(4) {
    transform: rotateY(-180deg) translateZ(65px);
  }
  .label:nth-child(5) { 
    transform: rotateY(-120deg) translateZ(65px);
  }
  .label:nth-child(6) { 
    transform: rotateY(-60deg) translateZ(65px);
  }
}


.no-wrap {
  border: none;
  background: none;
  
  .wrapper {
    position: static;
  }
}


.m-square .wrapper:hover .module {
    transition: transform 1.2s ease;
    transform: rotateY(-270deg);
}
.m-hexagone .wrapper:hover .module {
    transition: transform 1.8s ease;
    transform: rotateY(-300deg);
}





.debug {
  transition: all .5s ease;
  
  &.container {
    background: none;
  }
  
  &.wrapper {
    overflow: visible;
    transform: scale(0.8);
  }
  &.module {
    transform: rotateX(-30deg) rotateY(0deg) rotateZ(30deg);
  }
  &.label {
    border: 1px solid $red;
    backface-visibility: visible;
  }
}


.m-square .wrapper:hover .debug.module {
    transition: transform 10s linear;
    transform: rotateX(-30deg) rotateY(720deg) rotateZ(30deg);
}
.m-hexagone .wrapper:hover .debug.module {
    transition: transform 10s linear;
    transform: rotateX(-30deg) rotateY(720deg) rotateZ(30deg);
}





button {
  display: inline-block;
  margin: 1em 0 2em;
  height: 38px;
  padding: 0 30px;
  color: $light;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 38px;
  letter-spacing: -0.05em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  background-color: transparent;
  border-radius: 4px;
  border: 1px solid $light;
  cursor: pointer;
  box-sizing: border-box;
}


button:hover,
button:focus {
  color: $darker;
  border-color: transparent;
  outline: 0;
  background: $blue;
}


button:active {
  background: #188FB4;
  color: rgba(255,255,255,0.2);
  text-shadow: 0 1px 0 rgba(0,0,0,0.5);
}





/*
 * CUSTOM CAROUSELS CLASSES HERE
 */




              
            
!

JS

              
                $( document ).ready(function() {

  // Toggle Debug Classes
  $("button").click( function() {
    
    var thisButton = $(this);
    var c_container = thisButton.parent().find('.container');
    var c_wrapper = thisButton.parent().find('.wrapper');
    var c_module = thisButton.parent().find('.module');
    var c_label = thisButton.parent().find('.label');
    
    c_container.toggleClass('debug');
    c_wrapper.toggleClass('debug');
    c_module.toggleClass('debug');
    
    c_label.each( function() {
        $(this).toggleClass('debug');
    });
    
  });
  
});
              
            
!
999px

Console