All Projects → brunjo → Rowgrid.js

brunjo / Rowgrid.js

Licence: mit
A small, lightweight JavaScript plugin for placing items in straight rows (jQuery and vanilla JS version) – Demo:

Projects that are alternatives of or similar to Rowgrid.js

Ax5ui Grid
Javascript UI Component - GRID ( Excel Grid, jqGrid, angularjs grid, jquery grid, SlickGrid, ag-grid gridify)
Stars: ✭ 102 (-84.78%)
Mutual labels:  jquery-plugin, grid, jquery
Elastic Columns
A jQuery plugin designed to be used as an alternative to the well-known Isotope library.
Stars: ✭ 39 (-94.18%)
Mutual labels:  jquery-plugin, grid, jquery
Gijgo
Gijgo - Free Javascript Controls
Stars: ✭ 424 (-36.72%)
Mutual labels:  jquery-plugin, grid, jquery
Bs grid
Bootstrap Datagrid
Stars: ✭ 184 (-72.54%)
Mutual labels:  jquery-plugin, grid, jquery
Hc Sticky
JavaScript library that makes any element on your page visible while you scroll.
Stars: ✭ 375 (-44.03%)
Mutual labels:  jquery-plugin, jquery
Jquery Smartwizard
The awesome jQuery step wizard plugin
Stars: ✭ 635 (-5.22%)
Mutual labels:  jquery-plugin, jquery
Form2js
Javascript library for collecting form data
Stars: ✭ 630 (-5.97%)
Mutual labels:  jquery-plugin, jquery
Bootstrap Submenu
Bootstrap sub-menus
Stars: ✭ 442 (-34.03%)
Mutual labels:  jquery-plugin, jquery
Datetimepicker
jQuery Plugin Date and Time Picker
Stars: ✭ 3,402 (+407.76%)
Mutual labels:  jquery-plugin, jquery
Bigslide.js
⚠️**DEPRECATED**⚠️ A tiny slide panel navigation jQuery plugin with big dreams
Stars: ✭ 415 (-38.06%)
Mutual labels:  jquery-plugin, jquery
Peity
Progressive <svg> pie, donut, bar and line charts
Stars: ✭ 4,214 (+528.96%)
Mutual labels:  jquery-plugin, jquery
Jcanvas
A jQuery plugin that makes the HTML5 canvas easy to work with.
Stars: ✭ 612 (-8.66%)
Mutual labels:  jquery-plugin, jquery
Material Cards
Card style based on Google Material color palette
Stars: ✭ 370 (-44.78%)
Mutual labels:  jquery-plugin, jquery
Tabulator
Interactive Tables and Data Grids for JavaScript
Stars: ✭ 4,329 (+546.12%)
Mutual labels:  grid, jquery
Protip
A new generation jQuery Tooltip plugin
Stars: ✭ 357 (-46.72%)
Mutual labels:  jquery-plugin, jquery
Jquery.sumoselect
A jQuery Single/Multi Select plugin which can be used on almost any device
Stars: ✭ 527 (-21.34%)
Mutual labels:  jquery-plugin, jquery
Jquery Cropper
A jQuery plugin wrapper for Cropper.js.
Stars: ✭ 516 (-22.99%)
Mutual labels:  jquery-plugin, jquery
Isinviewport
An ultra-light jQuery plugin that tells you if an element is in the viewport but with a twist.
Stars: ✭ 646 (-3.58%)
Mutual labels:  jquery-plugin, jquery
Bootstrap Fileinput
An enhanced HTML 5 file input for Bootstrap 5.x/4.x./3.x with file preview, multiple selection, and more features.
Stars: ✭ 5,097 (+660.75%)
Mutual labels:  jquery-plugin, jquery
Jquery Loading
Easily add and manipulate loading states of any element on the page.
Stars: ✭ 321 (-52.09%)
Mutual labels:  jquery-plugin, jquery

rowGrid.js

rowGrid.js is a small, lightweight (~1000 bytes gzipped) jQuery plugin for placing images (or other items) in straight rows.

The grid is similar to grids on Google Image Search, flickr, shutterstock and Google+ images.

Features:

  • responsive
  • infinite scrolling
  • support for all modern browsers and IE >= 8

A vanilla JavaScript version is available that doesn't require jQuery: https://github.com/brunjo/rowGrid

Example Grid

Do you like this project? Follow me on Twitter @3runjo.

How does it work?

All items must have the same height but the width can be variable. RowGrid.js justifies the items in straight rows so that the width of the rows equals the width of the container/parent element. At first rowGrid.js adjusts the margin between the items. If this is not enough rowGrid.js scales down the items.

Demos & Examples

Examples with explanation: http://brunjo.github.io/rowGrid.js/

Real world example: https://www.pexels.com/

Installation

RowGrid.js requires jQuery 1.7 or above.

<script src="path/to/jquery.min.js"></script>
<script src="path/to/jquery.row-grid.min.js"></script>

Alternativlly, if you don't want to host rowGrid.js yourself, you can use cdnjs: https://cdnjs.com/libraries/rowgrid.js

You can also install it with Bower or npm:

  • Install with Bower: bower install rowGrid.js.
  • Install with npm: npm install rowgrid.js.

Usage

It is important that you either declare the width and height as attributes on the img tag or that you wait until the images are loaded before you start rowGrid.js.

HTML:

<div class="container">
  <div class="item">
    <img src="path/to/image" width="320" height="200" />
  </div>
  <div class="item">
    <img src="path/to/image" width="290" height="200" />
  </div>
  ...
</div>

JS:

var options = {minMargin: 10, maxMargin: 35, itemSelector: ".item"};
$(".container").rowGrid(options);

Endless Scrolling

JS:

// append new items
$(".container").append("<div class='item'><img src='http://placehold.it/310x200' /></div>");
// arrange appended items
$(".container").rowGrid("appended");

Options

$(".container").rowGrid({
    itemSelector: ".item"
    minMargin: 10,
    maxMargin: 35,
    resize: true,
    lastRowClass: "last-row",
    firstItemClass: "first-item"
});

itemSelector (required)

  • value: string (CSS Selector)

You have to set this option. The selector have to reference to all grid items.

minMargin

  • value: number or null
  • default value: null

This is the minimal horizontal margin between the items. The margin is only between the items not between the first/last item and the container.

maxMargin

  • value: number or null
  • default value: null

This is the maximal horizontal margin between the items.

resize

  • value: boolean
  • default value: true

If resize is set to true the layout updates on resize events. This is useful for responsive websites.

lastRowClass

  • value: string
  • default value: last-row

The first item in the last row gets this class.

firstItemClass

  • value: string or null
  • default value: null

The first item in every row gets this class.

lastItemClass

  • value: string or null
  • default value: null

The last item in every row gets this class.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].