--- layout: default title: Using images with imagesloaded.js description: A Shuffle.js demo using Desandro's imagesLoaded plugin. This comes in very handy when using shuffle with images affect the layout of shuffle items image: /demos/images.jpg extraJS: [ "imagesloaded.pkgd.js", "demos/images.js"] prism: true ---

Images!

You can encounter problems when shuffle item dimensions depend on images. Like this demo. There are three good solutions to this.

  1. Set an explicit height on .shuffle-items like the basic demo.
  2. Similar to number 1, make the height of the image container a percentage of the width. This can be seen in the nav above with the div.keep-ratio. Note: if you want to support IE, you'll need another element inside that div.keep-ratio which is positioned absolute with top/right/bottom/left all zero.
  3. Get notified when images load (this page). In this case, I'm using Desandro's images loaded plugin
Loading...
{% for item in site.items %}
{{item.title}}
{{ item.groups }}
{% endfor %}

Another section

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.