---
layout: default
title: Image based items
description: A demo of how NOT to use images with shuffle
extraJS: [ "demos/images.js"]
---

<div class="container">
  <div class="row">
    <div class="col-12@sm">
      <h2>This probably looks broken.</h2>
      <p>In this demo, the height of each item in the grid depends on the image. If Shuffle is initialized before the images load, the heights it calculates will be incorrect. <a href="{{ site.baseurl }}{% post_url 2013-05-03-images %}">See here</a> for a solution.</p>
      <p>Resize the window and it'll fix itself.</p>
    </div>
  </div>
</div>


<style>
  .my-grid-with-images {
    position: relative;
    overflow: hidden;
  }

  .my-grid-with-images .img-item {
    margin-top: 10px;
    margin-left: 0;
  }

  .my-grid-with-images .img-item img {
    width: 100%;
  }

</style>

<div class="container">
  <div class="my-grid-with-images row">
    {% for item in site.items %}
    <figure class="js-item img-item col-3@sm col-3@xs">
      <img src="{{ site.baseurl }}/img/{{ item.img }}" alt="{{item.title}}"/>
      <figcaption>{{ item.groups | join: ', ' }}</figcaption>
    </figure>
    {% endfor %}
    <div class="col-3@sm col-3@xs" id="js-sizer"></div>
  </div>
</div>

{% include credit-jake.html %}
