Coder Social home page Coder Social logo

wookmark-jquery's Introduction

jQuery Wookmark

This is a jQuery plugin for laying out a dynamic grid of elements.

See the documentation page for examples.

The repository also includes two functional examples. All images used in the example are copyrighted by their respective owners and only included for showcasing plugin functionality.

Installation

Prequisites

Required files

Copy jquery.wookmark.js to your javascript folder.

Usage

The plugin can be called with jQuery in different ways.

Standard call with default settings:

$('.myElements').wookmark();

Where myElement is the class of the items you want to lay out in a grid.

Options

$('.myElements').wookmark({
  align: 'center',
  autoResize: false,
  container: $('#myContent'),
  itemWidth: 0,
  offset: 2,
  resizeDelay: 50,
  flexibleWidth: 0,
  onLayoutChanged: undefined
});

See the documentation page for details on available options.

itemWidth and flexibleWidth

These values can be given as numbers which will be interpreted as pixels or you can use percentage strings like '20%'. If you use a percentage string for itemWidth the number of columns will be fixed and items may overlap if the viewport is small.

Refresh trigger

Elements which are hidden have cannot be laid out until they are visible. If you use wookmark on a hidden tab layout will not be immediately performed. When the tab is made visible you can manually refresh wookmark using a trigger on your container.

$('#myContent').trigger('refreshWookmark');

Included examples

/example Is the preferred setup. In this scenario the width and height of all images is set in the HTML img attributes. The grid layout can be performed as soon as the document is rendered, BEFORE images are loaded.

/example-load-images In this example, the width and height of the images is not known. Via Paul Irish's imagesLoaded plugin (slightly modified by desandro). The grid layout is performed after all images are loaded and their dimensions can be retrieved. This approach is much slower. The imagesLoaded plugin can also be found on github right here: https://gist.github.com/797120

Feedback

Please send code specific questions and feedback to Sebastian or contact him on twitter.

If you have other questions and feedback which is for example related to Wookmark send a mail to Christoph or contact him on twitter.

Contributing

Contribute!

wookmark-jquery's People

Contributors

sebobo avatar gbks avatar davebrace avatar jamedjo avatar chrillo avatar matt-d-rat avatar quangkcao avatar sandeepshetty avatar tclancy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.