Skip to content

Instantly share code, notes, and snippets.

@capaj
Created October 12, 2013 13:02
Show Gist options
  • Save capaj/6949809 to your computer and use it in GitHub Desktop.
Save capaj/6949809 to your computer and use it in GitHub Desktop.
gridster jsdoc comment
/**
* @class Gridster
* @uses Draggable
* @uses Collision
* @param {HTMLElement} el The HTMLelement that contains all the widgets.
* @param {Object} [options] An Object with all options you want to
* overwrite:
* @param {HTMLElement|String} [options.widget_selector] Define who will
* be the draggable widgets. Can be a CSS Selector String or a
* collection of HTMLElements
* @param {Array} [options.widget_margins] Margin between widgets.
* The first index for the horizontal margin (left, right) and
* the second for the vertical margin (top, bottom).
* @param {Array} [options.widget_base_dimensions] Base widget dimensions
* in pixels. The first index for the width and the second for the
* height.
* @param {Number} [options.extra_cols] Add more columns in addition to
* those that have been calculated.
* @param {Number} [options.extra_rows] Add more rows in addition to
* those that have been calculated.
* @param {Number} [options.min_cols] The minimum required columns.
* @param {Number} [options.min_rows] The minimum required rows.
* @param {Number} [options.max_size_x] The maximum number of columns
* that a widget can span.
* @param {Boolean} [options.autogenerate_stylesheet] If true, all the
* CSS required to position all widgets in their respective columns
* and rows will be generated automatically and injected to the
* `<head>` of the document. You can set this to false, and write
* your own CSS targeting rows and cols via data-attributes like so:
* `[data-col="1"] { left: 10px; }`
* @param {Boolean} [options.avoid_overlapped_widgets] Avoid that widgets loaded
* from the DOM can be overlapped. It is helpful if the positions were
* bad stored in the database or if there was any conflict.
* @param {Function} [options.serialize_params] Return the data you want
* for each widget in the serialization. Two arguments are passed:
* `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid
* coords object (`col`, `row`, `size_x`, `size_y`).
* @param {Object} [options.collision] An Object with all options for
* Collision class you want to overwrite. See Collision docs for
* more info.
* @param {Object} [options.draggable] An Object with all options for
* Draggable class you want to overwrite. See Draggable docs for more
* info.
*
* @constructor
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment