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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <ul class="grid">
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=1" alt="" />
			<div class="info">
				<p>Kitty 1</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=2" alt="" />
			<div class="info">
				<p>Kitty 2</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=3" alt="" />
			<div class="info">
				<p>Kitty 3</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=4" alt="" />
			<div class="info">
				<p>Kitty 4</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=5" alt="" />
			<div class="info">
				<p>Kitty 5</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=6" alt="" />
			<div class="info">
				<p>Kitty 6</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=7" alt="" />
			<div class="info">
				<p>Kitty 7</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=8" alt="" />
			<div class="info">
				<p>Kitty 8</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=9" alt="" />
			<div class="info">
				<p>Kitty 9</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=10" alt="" />
			<div class="info">
				<p>Kitty 10</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=11" alt="" />
			<div class="info">
				<p>Kitty 11</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=12" alt="" />
			<div class="info">
				<p>Kitty 12</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=13" alt="" />
			<div class="info">
				<p>Kitty 13</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=14" alt="" />
			<div class="info">
				<p>Kitty 14</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=15" alt="" />
			<div class="info">
				<p>Kitty 15</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=1" alt="" />
			<div class="info">
				<p>Kitty 16</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=2" alt="" />
			<div class="info">
				<p>Kitty 17</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=3" alt="" />
			<div class="info">
				<p>Kitty 18</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=4" alt="" />
			<div class="info">
				<p>Kitty 19</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=5" alt="" />
			<div class="info">
				<p>Kitty 20</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=6" alt="" />
			<div class="info">
				<p>Kitty 21</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=7" alt="" />
			<div class="info">
				<p>Kitty 22</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=8" alt="" />
			<div class="info">
				<p>Kitty 23</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=9" alt="" />
			<div class="info">
				<p>Kitty 24</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=10" alt="" />
			<div class="info">
				<p>Kitty 25</p>
			</div>
		</a>
	</li>
 <li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=11" alt="" />
			<div class="info">
				<p>Kitty 26</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=12" alt="" />
			<div class="info">
				<p>Kitty 27</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=13" alt="" />
			<div class="info">
				<p>Kitty 28</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=14" alt="" />
			<div class="info">
				<p>Kitty 29</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=15" alt="" />
			<div class="info">
				<p>Kitty 30</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=1" alt="" />
			<div class="info">
				<p>Kitty 31</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=2" alt="" />
			<div class="info">
				<p>Kitty 32</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=3" alt="" />
			<div class="info">
				<p>Kitty 33</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=4" alt="" />
			<div class="info">
				<p>Kitty 34</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=5" alt="" />
			<div class="info">
				<p>Kitty 35</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=6" alt="" />
			<div class="info">
				<p>Kitty 36</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=7" alt="" />
			<div class="info">
				<p>Kitty 37</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=8" alt="" />
			<div class="info">
				<p>Kitty 38</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=9" alt="" />
			<div class="info">
				<p>Kitty 39</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=10" alt="" />
			<div class="info">
				<p>Kitty 40</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=11" alt="" />
			<div class="info">
				<p>Kitty 41</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=12" alt="" />
			<div class="info">
				<p>Kitty 42</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=13" alt="" />
			<div class="info">
				<p>Kitty 43</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=14" alt="" />
			<div class="info">
				<p>Kitty 44</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=15" alt="" />
			<div class="info">
				<p>Kitty 45</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=1" alt="" />
			<div class="info">
				<p>Kitty 46</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=2" alt="" />
			<div class="info">
				<p>Kitty 47</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=3" alt="" />
			<div class="info">
				<p>Kitty 48</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=4" alt="" />
			<div class="info">
				<p>Kitty 49</p>
			</div>
		</a>
	</li>
	<li>
		<a href="#">
			<img src="http://placekitten.com/200/200?image=5" alt="" />
			<div class="info">
				<p>Kitty 50</p>
			</div>
		</a>
	</li>
</ul>
            
          
!
            
              body {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 16px;
  
  -webkit-font-smoothing		: antialiased
}

.grid {
  margin: 0 auto;
  padding: 0;
  width: 100%;
  max-width: 1000px;
}

.grid li {
  width: 10%;
  background: #000000;
  float: left;
  position: relative;
  overflow: hidden;
}

.grid img {
  float: left;
  width: 100%;
  height: auto;
  position: relative;
  
  -webkit-transform-style: preserve-3d;
  -webkit-backface-visibility: hidden;
	 -webkit-transform: translate3d(0,0,0);
}

.grid .info {
  position: absolute;
  width: 100%;
  height: 100%;
  padding: 15px;
  background: #DC584C;
  display: none;
  z-index: 2;
  
  -webkit-transform-style: preserve-3d;
  -webkit-backface-visibility: hidden;
	 -webkit-transform: translate3d(0,0,0);
}

.grid p {
  font-size: 14px;
  font-weight: bold;
  color: #FFF;
}
            
          
!
            
              ###
Simple effect for roll over on grids, where the content slides based on the previous position.

You can see also in use here: http://worldbakingday.com

Libraries: jQuery and jQuery.transit
###

$ ->
  grid = $ ".grid"
  current = index:-1, column:0, line:0
  
  columns = 10
  easing = "cubic-bezier(0.165, 0.840, 0.440, 1.000)"
  time = 400
    
  grid.on "mouseenter", "a", (e) =>
    el = $ e.currentTarget
    info = el.find ".info"
    image = el.find "img"
    index = el.parent().index()
    column = index % columns
    line = Math.floor(index / columns)
    console.log index, column, line
    item = el:el, index:index, column:column, line:line, info:info, image:image
    
    # stop if the 
    return if current.el and current.index is index
  
    if line == current.line and column > current.column
      showItem item, "-100%", 0, "25%", 0
      hideItem current, "100%", 0, "-25%", 0
    else if line == current.line and column < current.column
      showItem item, "100%", 0, "-25%", 0
      hideItem current, "-100%", 0, "25%", 0
    else if line > current.line and column == current.column
      showItem item, 0, "-100%", 0, "25%"
      hideItem current, 0, "100%", 0, "-25%"
    else
      showItem item, 0, "100%", 0, "-25%"
      hideItem current, 0, "-100%", 0, "25%"
  
    current = item
  
  showItem = (item, infoX, infoY, imageX, imageY) ->
    item.info.stop().css(x:infoX, y:infoY, display:"block").transition x:0, y:0, duration:time, easing:easing
    item.image.stop().transition x:imageX, y:imageY, opacity:.5, duration:time, easing:easing
  
  hideItem = (item, infoX, infoY, imageX, imageY) ->
    return unless item.el
    item.info.stop().transition x:infoX, y:infoY, duration:time, easing:easing
    item.image.stop().css(x:imageX, y:imageY, opacity:.5).transition x:0, y:0, opacity:1, duration:time, easing:easing
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console