JQuery Packery Center Items

937 views Asked by At

In my JQuery Packery app I want to center my items inside the container element. I use the following structure:

<div id="container">
  <div class="item">...</div>
  <div class="item w2">...</div>
  <div class="item">...</div>
  ...
</div>

I used JQuery Isotope before where I could apply a fix to center the items. My problem is when you have only few items they do not get fixed.

  1. Here is one solution which I modified from this one from the plugin's author:

Only the container is centered but not the items inside.

enter image description here

  1. Here is a second solution:

enter image description here

What I want to have is the following. The container width must be bounded by the items such that the container appears centered as well as the items. How can I get that?

enter image description here

1

There are 1 answers

0
OfficeDoge On