1. New
  2. Categories
  3. Surprise
  4. Videos
  5. Colors
Log in

Help

Wookmark

The Wookmark jQuery plugin

We have received several questions about how the grid layout on wookmark.com is created so we created this simple plugin. It lays out a series of elements in a dynamic column grid.

Mentioned by Web Appers, Design Shack, Web Design Ledger, SpeckyBoy, Queness, Web Resources Depot, HongKiat, DevSnippets, CodeVisually, How Design, Tympanus, David Walsh, JaxEnter and others.

How to use it

  1. Download the Javascript plugin file from the Github repository
  2. Include the file in your website (after your include of jQuery)

  3. Run it on your content

  4. Adjust the options (all optional, see GitHub for examples)

    • align - "left", "right", or "center"
    • autoResize - if "true", updates layout after browser is resized
    • resizeDelay - default is "50", time in miliseconds between browser resize and layout update
    • comparator - a custom sorting function
    • container - the width of this element is used to calculate the number of columns, defaults to "window". For example $('myContentGrid'). Container should also have the CSS property "position: relative".
    • direction - "left" or "right", whether to start in top left or top right corner
    • ignoreInactiveItems - if "true", inactive items will still be visible, which can be used to fade filtered items out
    • itemWidth - width of one grid item in pixels ("200") or percentage ("10%"), defaults to width of first item
    • fillEmptySpace - if "true", creates placeholder at bottom of each column to create an even layout. Placeholders elements have the class "wookmark-placeholder".
    • flexibleWidth - "true" or "false", adjusts item width to create optimal layout based on browser size
    • offset - vertical and horizontal distance between items, defaults to 2
    • onLayoutChanged - a function that gets called after every layout change
    • outerOffset - default is "0"

See examples (sorting, filtering, stamping, endless scroll, lightbox, API integration...) and contribute, Wookmark on github. Have fun.

Wookmark jQuery plugin example

A live example

Below are the current 20 most popular images on wookmark.com. The Wookmark plugin detects the size of the window and automatically organizes the images into columns. Resize your browser to see the layout adjust. Note how the columns are approximately of equal height.

  • 1c041af74e0d1db22583837.png (PNG Image, 500 × 750 pixels) - Scaled (99%)
  • Animal Sculptures by Tomohiro Inaba – Fubiz™
  • Flat Icon set by Mike | Inspiration DE
  • ?????????? ?????????????? | 2 713 ??????????
  • 5b7372495804630fefbcc95.jpg (JPEG Image, 499 × 750 pixels) - Scaled (99%)
  • Cezar Brandao - Sketchbook2 - Page 21
  • My little mountain tattoo is almost healed | Inspiration DE
  • Cezar Brandao - Sketchbook2 - Page 21
  • 9c88355937f1c8b6cd90ae4b.jpg (JPEG Image, 640 × 960 pixels) - Scaled (77%)
  • Look at me! | Inspiration DE
  • e7345d9065cbca50ccf8258c8eb09669.jpg (JPEG Image, 494 × 500 pixels)
  • a33f8711b43bc41e61447817.jpg (JPEG Image, 667 × 768 pixels) - Scaled (96%)
  • The New Heroes & Pioneers on
  • 8f6af8a5b5bd3094ab6c943.jpg (JPEG Image, 500 × 694 pixels)
  • a291b3884853d8dc9b198e9.jpg (JPEG Image, 683 × 1024 pixels) - Scaled (72%)
  • Cezar Brandao - Sketchbook2 - Page 21
  • 25 Mobile App Designs Featuring Grapch and Charts | Inspiration
  • 70c4ba14d8b7f05b49e78369a0a2f6fc.jpg (JPEG Image, 736 × 408 pixels)
  • ac877ac0cc8657459f9cf0.png (PNG Image, 834 × 1250 pixels) - Scaled (59%)