cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-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.

            
              <!--images from http://haryarti.deviantart.com/gallery/-->
<div class="container">
  <ul class="gallery">
    <li>
      <div class="flip">
        <div class="front-side"></div>
        <div class="back-side">
          <a href="#">
            <div class="content">
              <div class="loader"></div>
              <div class="text">
                <h3>LINA</h3>
                <p>The sibling rivalries between Lina the Slayer, and her younger sister Rylai, the Crystal Maiden, were the stuff of legend in the temperate region where they spent their quarrelsome childhoods together. Lina always had the advantage, however, for while Crystal was guileless and naive, Lina's fiery ardor was tempered by cleverness and conniving. The exasperated parents of these incompatible offspring went through half a dozen homesteads, losing one to fire, the next to ice, before they realized life would be simpler if the children were separated.</p>
              </div>
            </div>
          </a>
        </div>
      </div>
    </li>
    <li>
      <div class="flip">
        <div class="front-side"></div>
        <div class="back-side">
          <a href="#">
            <div class="content">
              <div class="loader"></div>
              <div class="text">
                <h3>CRYSTAL MAIDEN</h3>
                <p>Born in a temperate realm, raised with her fiery older sister Lina, Rylai the Crystal Maiden soon found that her innate elemental affinity to ice created trouble for all those around her. Wellsprings and mountain rivers froze in moments if she stopped to rest nearby; ripening crops were bitten by frost, and fruiting orchards turned to mazes of ice and came crashing down, spoiled. When their exasperated parents packed Lina off to the equator, Rylai found herself banished to the cold northern realm of Icewrack, where she was taken in by an Ice Wizard who had carved himself a hermitage at the crown of the Blueheart Glacier.</p>
              </div>
            </div>
          </a>
        </div>
      </div>
    </li>
    <li>
      <div class="flip">
        <div class="front-side"></div>
        <div class="back-side">
          <a href="#">
            <div class="content">
              <div class="loader"></div>
              <div class="text">
                <h3>DROW RANGER</h3>
                <p>Drow Ranger's given name is Traxex--a name well suited to the short, trollish, rather repulsive Drow people. But Traxex herself is not a Drow. Her parents were travelers in a caravan set upon by bandits, whose noisy slaughter of innocents roused the ire of the quiet Drow people. After the battle settled, the Drow discovered a small girl-child hiding in the ruined wagons, and agreed she could not be abandoned. Even as child, Traxex showed herself naturally adept at the arts they prized: Stealth, silence, subtlety. In spirit, if not in physique, she might have been a Drow changeling, returned to her proper home. But as she grew, she towered above her family and came to think of herself as ugly.</p>
              </div>
            </div>
          </a>
        </div>
      </div>
    </li>
    <li>
      <div class="flip">
        <div class="front-side"></div>
        <div class="back-side">
          <a href="#">
            <div class="content">
              <div class="loader"></div>
              <div class="text">
                <h3>WINDRANGER</h3>
                <p>The western forests guard their secrets well. One of these is Lyralei, master archer of the wood, and favored godchild of the wind. Known now as Windranger, Lyralei's family was killed in a storm on the night of her birth--their house blown down by the gale, contents scattered to the winds. Only the newborn survived among the debris field of death and destruction. In the quiet after the storm, the wind itself took notice of the lucky infant crying in the grass. The wind pitied the child and so lifted her into the sky and deposited her on a doorstep in a neighboring village.</p>
              </div>
            </div>
          </a>
        </div>
      </div>
    </li>
    <li>
      <div class="flip">
        <div class="front-side"></div>
        <div class="back-side">
          <a href="#">
            <div class="content">
              <div class="loader"></div>
              <div class="text">
                <h3>DEATH PROPHET</h3>
                <p>Krobelus was a Death Prophet--which is one way of saying she told fortunes for the wealthiest of those who wished to look beyond the veil. But after years of inquiring on behalf of others, she began to seek clues on her own fate. When death refused to yield its secrets, she tried to buy them with her life. But the ultimate price proved insufficient. Death disgorged her again and again, always holding back its deepest mysteries. </p>
              </div>
            </div>
          </a>
        </div>
      </div>
    </li>
    <li>
      <div class="flip">
        <div class="front-side"></div>
        <div class="back-side">
          <a href="#">
            <div class="content">
              <div class="loader"></div>
              <div class="text">
                <h3>KATARINA</h3>
                <p>Driven by an intense killer instinct, Katarina uses her talents as an assassin for the glory of Noxus, and the continued elevation of her family. While her fervor drives her to ever-greater feats, it can sometimes lead her astray.</p>
              </div>
            </div>
          </a>
        </div>
      </div>
    </li>
    <li>
      <div class="flip">
        <div class="front-side"></div>
        <div class="back-side">
          <a href="#">
            <div class="content">
              <div class="loader"></div>
              <div class="text">
                <h3>VENGEFUL SPIRIT</h3>
                <p>Even the most contented Skywrath is an ill-tempered creature, naturally inclined to seek revenge for the slightest insult. But Vengeful Spirit is the essence of vengeance. Once a proud and savage Skywrath scion, Shendelzare was first in succession for the Ghastly Eyrie until a sister's treachery robbed her of her birthright. Snared in an assassin's net, Shendelzare tore free only at the cost of her wings, limping away in the ultimate humiliation: On foot. With her wings broken, she knew the Skywrath would never accept her as ruler; and in the highest roost of the Eyrie, inaccessible except by winged flight, her sister was untouchable.</p>
              </div>
            </div>
          </a>
        </div>
      </div>
    </li>
    <li>
      <div class="flip">
        <div class="front-side"></div>
        <div class="back-side">
          <a href="#">
            <div class="content">
              <div class="loader"></div>
              <div class="text">
                <h3>LINA</h3>
                <p>The sibling rivalries between Lina the Slayer, and her younger sister Rylai, the Crystal Maiden, were the stuff of legend in the temperate region where they spent their quarrelsome childhoods together. Lina always had the advantage, however, for while Crystal was guileless and naive, Lina's fiery ardor was tempered by cleverness and conniving. The exasperated parents of these incompatible offspring went through half a dozen homesteads, losing one to fire, the next to ice, before they realized life would be simpler if the children were separated.</p>
              </div>
            </div>
          </a>
        </div>
      </div>
    </li>
  </ul>
</div>
            
          
!
            
              @import "https://fonts.googleapis.com/css?family=Open+Sans";

html {
  height: 100%;
}
body {
  background: #181818;
  color: #F0F3F4;
  font: normal 16px/1.25 'Open Sans';
  min-height: 100%;
  height: 100%;
  overflow: hidden;
}
* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}
a {
  text-decoration: none;
}
.container {
  height: 100%;
}
.gallery {
  list-style-type: none;
  height: 100%;
  overflow: hidden;
}
.gallery li {
  float: left;
  height: 100%;
  width: 400px;
  background: #2E4053;
}
.gallery .flip {
  height: 100%;
  width: 100%;
  position: relative;
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  transform-style: preserve-3d;

  -webkit-perspective: 2000px;
  -moz-perspective: 2000px;
  perspective: 2000px;
}
.gallery li:hover .front-side {
  opacity: 0;
  -webkit-transform: rotateY(180deg);
  -moz-transform: rotateY(180deg);
  transform: rotateY(180deg);
}
.gallery li:hover .back-side {
  background: #000;
  opacity: 1;
  -webkit-transform: rotateY(0deg);
  -moz-transform: rotateY(0deg);
  transform: rotateY(0deg);
}
.gallery .front-side,
.gallery .back-side {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility:  hidden;
  -moz-backface-visibility:  hidden;
  backface-visibility:  hidden;

  -webkit-transition: transform 0.4s ease-out, opacity 0.3s ease-out;
  -moz-transition: transform 0.4s ease-out, opacity 0.3s ease-out;
  transition: transform 0.4s ease-out, opacity 0.3s ease-out;
}
.gallery .front-side {
  opacity: 1;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: 50% 50%;

  -webkit-transform: rotateY(0deg);
  -moz-transform: rotateY(0deg);
  transform: rotateY(0deg);
}
.gallery .back-side {
  opacity: 0;
  -webkit-transform: rotateY(-180deg);
  -moz-transform: rotateY(-180deg);
  transform: rotateY(-180deg);
}
.gallery .back-side > a {
  display: block;
  width: 100%;
  height: 100%;
}

.gallery li:nth-child(1) .front-side {
  background-image:url('http://pre12.deviantart.net/f04f/th/pre/i/2015/281/c/e/virtus_pro_tribute_by_haryarti-d9cdvwy.jpg');
}
.gallery li:nth-child(1) .loader {
  border-top-color: #F39C12;
  border-left-color: #F39C12;
}
.gallery li:nth-child(1) .text h3 {
  color: #F39C12;
}
.gallery li:nth-child(1) .text h3:after {
  background: #F5B041;
}

.gallery li:nth-child(2) .front-side {
  background-image: url('http://pre06.deviantart.net/f121/th/pre/i/2014/280/7/a/crystal_maiden_by_haryarti-d81xgfl.jpg');
}

.gallery li:nth-child(3) .front-side {
  background-image: url('http://pre10.deviantart.net/3566/th/pre/i/2014/289/5/a/drow_ranger_by_haryarti-d83292f.jpg');
}
.gallery li:nth-child(3) .loader {
  border-top-color: #424949;
  border-left-color: #424949;
}
.gallery li:nth-child(3) .text h3 {
  color: #424949;
}
.gallery li:nth-child(3) .text h3:after {
  background: #515A5A;
}

.gallery li:nth-child(4) .front-side {
  background-image: url('http://pre01.deviantart.net/c319/th/pre/i/2014/322/e/a/windrunner_by_haryarti-d86ubud.jpg');
}
.gallery li:nth-child(4) .loader {
  border-top-color: #F1C40F;
  border-left-color: #F1C40F;
}
.gallery li:nth-child(4) .text h3 {
  color: #F1C40F;
}
.gallery li:nth-child(4) .text h3:after {
  background: #F7DC6F;
}

.gallery li:nth-child(5) .front-side {
  background-image: url('http://pre04.deviantart.net/5815/th/pre/f/2014/149/7/7/death_prophet_from_dota_2_by_o_l_i_v_i-d7k2ekl.jpg');
}
.gallery li:nth-child(5) .loader {
  border-top-color: #1ABC9C;
  border-left-color: #1ABC9C;
}
.gallery li:nth-child(5) .text h3 {
  color: #1ABC9C;
}
.gallery li:nth-child(5) .text h3:after {
  background: #48C9B0;
}

.gallery li:nth-child(6) .front-side {
  background-image: url('http://pre02.deviantart.net/ce96/th/pre/i/2015/177/7/7/katarina_by_haryarti-d8ytd5o.jpg');
}
.gallery li:nth-child(6) .loader {
  border-top-color: #E74C3C;
  border-left-color: #E74C3C;
}
.gallery li:nth-child(6) .text h3 {
  color: #E74C3C;
}
.gallery li:nth-child(6) .text h3:after {
  background: #EC7063;
}

.gallery li:nth-child(7) .front-side {
  background-image: url('http://pre10.deviantart.net/cbaf/th/pre/i/2015/047/0/2/vengeful_spirit_by_haryarti-d8iau4i.png');
}
.gallery li:nth-child(7) .loader {
  border-top-color: #8E44AD;
  border-left-color: #8E44AD;
}
.gallery li:nth-child(7) .text h3 {
  color: #8E44AD;
}
.gallery li:nth-child(7) .text h3:after {
  background: #A569BD;
}

.gallery li:nth-child(8) .front-side {
  background-image: url('http://pre06.deviantart.net/73a2/th/pre/i/2014/080/5/7/lina_by_haryarti-d7b48eu.jpg');
}
.gallery li:nth-child(8) .loader {
  border-top-color: #F39C12;
  border-left-color: #F39C12;
}
.gallery li:nth-child(8) .text h3 {
  color: #F39C12;
}
.gallery li:nth-child(8) .text h3:after {
  background: #F5B041;
}

.gallery .content {
  text-align: center;
  position: relative;
  top: 50%;
  -webkit-transform: translateY(-50%);
  -moz-transform: translateY(-50%);
  transform: translateY(-50%);
  padding: 25px 20px;
}

.gallery li:hover .text {
  opacity: 1;
  visibility: visible;
  max-height: 2000px;
  -webkit-transition: opacity .3s ease-in 1.5s, max-height .1s ease 1.5s;
  -moz-transition: opacity .3s ease-in 1.5s, max-height .1s ease 1.5s;
  transition: opacity .3s ease-in 1.5s, max-height .1s ease 1.5s;
}
.gallery li:hover .loader {
  opacity: 1;
  visibility: visible;
  -webkit-animation: hide .1s ease-in-out 1.4s forwards, load .75s infinite;
  -moz-animation: hide .1s ease-in-out 1.4s forwards, load .75s infinite;
  animation: hide .1s ease-in-out 1.4s forwards, load .75s infinite;
}
.gallery .text {
  opacity: 0;
  visibility: hidden;
  max-height: 0;
}
.gallery .content h3 {
  position: relative;
  color: #3498DB;
  font: normal 30px/1.25 'Open Sans';
  margin-bottom: 25px;
}
.gallery .content h3:after {
  content: '';
  position: absolute;
  width: 50px;
  height: 3px;
  bottom: -10px;
  left: 50%;
  margin-left: -25px;
  background: #85C1E9;
}
.gallery .content p {
  margin: 10px 0;
  color: #D6DBDF;
  font: normal 16px/1.25 'Open Sans';
}
.gallery .loader {
  opacity: 0;
  visibility: hidden;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin: auto;
  border: 4px solid transparent;
  border-top-color: #3498DB;
  border-left-color: #3498DB;
}

@-webkit-keyframes load {
  0% {
    -webkit-transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
  }
}
@-moz-keyframes load {
  0% {
    -moz-transform: rotate(0deg);
  }
  100% {
    -moz-transform: rotate(360deg);
  }
}
@keyframes load {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@-webkit-keyframes hide {
  100% {
    visibility: hidden;
    opacity: 0;
  }
}
@-moz-keyframes hide {
  100% {
    visibility: hidden;
    opacity: 0;
  }
}
@keyframes hide {
  100% {
    visibility: hidden;
    opacity: 0;
  }
}


            
          
!
            
              
var Gallery = (function() {
    var colors = ['#34495E', '#2E4053', '#283747', '#212F3C', '#1B2631', '#2C3E50', '#273746'];
    var scrollTimeId;
    var posLeft = 0;

    function Gallery(config) {
        this.list = $(config.list);
        this.items = this.list.find('li');
        this.itemWidth = this.items.outerWidth();
    };

    Gallery.prototype = {
        constructor: Gallery,

        init: function() {
            this.setGalleryWidth();
            this.setItemsColor();
            this.eventManager();

            return this;
        },

        eventManager: function() {
            var _this = this;

            $(document).on('mousewheel DOMMouseScroll', function(event) {
                clearTimeout(scrollTimeId);
                scrollTimeId = setTimeout(onScrollEventHandler.bind(this, event, _this.itemWidth), 0);
            });
        },

        getRandomColor: function() {
            return colors[Math.floor(Math.random() * colors.length)];
        },

        setItemsColor: function() {
            var _this = this;

            $.each(this.items, function(index, item) {
                 item.style.backgroundColor = _this.getRandomColor();
            });
        },

        setGalleryWidth: function() {
            this.list.css('width', this.getGalleryWidth());
        },

        getGalleryWidth: function() {
            var width = 0;

            this.items.each(function(index, item) {
                width += $(this).outerWidth();
            });

            return width;
        }
    };

    function onScrollEventHandler(event, width) {
        // Firefox, please, stop it
         if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
            if (event.originalEvent.detail > 0) {
                posLeft += width / 2;
                $('html').scrollLeft(posLeft);
            } else {
                posLeft -= width / 2;
                $('html').scrollLeft(posLeft);
            }
         } else {
            if (event.originalEvent.wheelDelta > 0)  {
                this.body.scrollLeft -= width / 2;
            } else {
                this.body.scrollLeft += width / 2;
            }
         }
        event.preventDefault();
    };

    return Gallery;
})();


$(document).ready(function() {
    var gallery = new Gallery({
        list: '.gallery'
    }).init();
});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

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

Console