├── .npmignore
├── .bowerrc
├── demos
├── assets
│ ├── img
│ │ └── sprite.png
│ ├── js
│ │ └── plugins.js
│ └── less
│ │ └── demo.less
├── index.html
├── adding-widgets-dynamically.html
├── dynamic-grid-width.html
├── grid-from-serialize.html
├── jquery.gridster.demo2.html
├── sticky-postion.html
├── resize.html
├── SwapDrop.html
├── expandable-widgets.html
├── using-drag-callbacks.html
├── using-resize-callbacks.html
├── custom-drag-handle.html
├── multiple-grids.html
├── serialize.html
├── resize-limits.html
├── chaosWidget.html
└── responsive.html
├── lib
├── gridster.js-rails
│ ├── version.rb
│ └── engine.rb
└── gridster.js-rails.rb
├── test
├── jquery-private.js
├── testsuite.js
├── amd-main.js
├── jquery.gridster.html
├── jquery.gridster-amd.html
├── lib
│ └── test_utils.js
└── jquery.gridster_test.js
├── .gitignore
├── .travis.yml
├── bower.json
├── gridster.js-rails.gemspec
├── LICENSE
├── package.json
├── README.md
├── dist
├── jquery.gridster.min.css
└── jquery.gridster.css
├── src
├── utils.js
├── jquery.coords.js
├── jquery.gridster.less
├── jquery.gridster.extras.js
├── jquery.collision.js
└── jquery.draggable.js
├── Gruntfile.js
├── .jshintrc
├── CONTRIBUTING.md
└── CHANGELOG.md
/.npmignore:
--------------------------------------------------------------------------------
1 | *
2 | !README.md
3 | !LICENSE
4 | !dist/**/*
--------------------------------------------------------------------------------
/.bowerrc:
--------------------------------------------------------------------------------
1 | {
2 | "directory": "libs",
3 | "json": "package.json"
4 | }
--------------------------------------------------------------------------------
/demos/assets/img/sprite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emackey/gridster.js/master/demos/assets/img/sprite.png
--------------------------------------------------------------------------------
/lib/gridster.js-rails/version.rb:
--------------------------------------------------------------------------------
1 | module Gridster
2 | module Rails
3 | VERSION = "0.6.10"
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/lib/gridster.js-rails.rb:
--------------------------------------------------------------------------------
1 | module Gridster
2 | module Rails
3 | require "gridster.js-rails/engine"
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/test/jquery-private.js:
--------------------------------------------------------------------------------
1 | define(['jquery'], function (jq) {
2 | 'use strict';
3 | return jq.noConflict( true );
4 | });
5 |
--------------------------------------------------------------------------------
/lib/gridster.js-rails/engine.rb:
--------------------------------------------------------------------------------
1 | module Gridster
2 | module Rails
3 | class Engine < ::Rails::Engine
4 | end
5 | end
6 | end
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | libs/
3 | gh-pages/
4 | demo/
5 | .idea
6 | .DS_Store
7 | *.iml
8 | vendor
9 | *.gem
10 | *.css.map
11 | demos/assets/css/demo.css
12 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "0.10"
4 | install:
5 | - npm install
6 | - npm install -g bower grunt-cli
7 | before_script:
8 | - bower install
9 | script:
10 | - grunt build --verbose
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "gridster",
3 | "homepage": "dsmorse.github.io/gridster.js/",
4 | "version": "0.6.10",
5 | "dependencies": {
6 | "jquery": "^2.1.3"
7 | },
8 | "devDependencies": {
9 | "requirejs": "^2.1.17",
10 | "qunit": "~1.18.0"
11 | },
12 | "main": [
13 | "dist/jquery.gridster.js",
14 | "dist/jquery.gridster.css"
15 | ],
16 | "private": false,
17 | "ignore": [
18 | ".bowerrc",
19 | ".jshintrc",
20 | ".gitignore",
21 | ".travis.yml",
22 | "CONTRIBUTING.md",
23 | "Gruntfile.js",
24 | "package.json",
25 | "test/",
26 | "gridster.js-rails.gemspec",
27 | "Gemfile",
28 | "Gemfile.lock",
29 | "lib"
30 | ]
31 | }
32 |
--------------------------------------------------------------------------------
/demos/assets/js/plugins.js:
--------------------------------------------------------------------------------
1 | // Avoid `console` errors in browsers that lack a console.
2 | (function () {
3 | var method;
4 | var noop = function () {
5 | };
6 | var methods = [
7 | 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
8 | 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
9 | 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
10 | 'timeStamp', 'trace', 'warn'
11 | ];
12 | var length = methods.length;
13 | var console = (window.console = window.console || {});
14 |
15 | while (length--) {
16 | method = methods[length];
17 |
18 | // Only stub undefined methods.
19 | if (!console[method]) {
20 | console[method] = noop;
21 | }
22 | }
23 | }());
24 |
25 | // Place any jQuery/helper plugins in here.
26 |
--------------------------------------------------------------------------------
/test/testsuite.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | define([
3 | 'QUnit',
4 | 'jquery',
5 | 'gridster'
6 | ], function(QUnit, $, gridster) {
7 |
8 | QUnit.module('Gridster AMD', {
9 | setup: function () {
10 | },
11 | teardown: function () {
12 | }
13 | });
14 |
15 | QUnit.test('window.$ should be undefined.', function() {
16 | equal(typeof window.$, 'undefined', 'window.$ should be undefined');
17 | equal(typeof window.jQuery, 'undefined', 'window.jQuery should be undefined');
18 | });
19 |
20 |
21 | QUnit.test('gridster should be initialized.', function() {
22 | $('.wrapper ul').gridster();
23 | equal($('.wrapper').hasClass('ready'), true, 'Gridster should initialized wrapper.');
24 | equal($('.wrapper ul li').length, $('.gs-w').length, 'grid elements get a .gs-w class');
25 | });
26 | }
27 | );
28 |
--------------------------------------------------------------------------------
/gridster.js-rails.gemspec:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | require File.expand_path('../lib/gridster.js-rails/version', __FILE__)
3 |
4 | Gem::Specification.new do |spec|
5 | spec.name = "gridster.js-rails"
6 | spec.version = Gridster::Rails::VERSION
7 | spec.authors = ["dsmorse"]
8 | spec.email = ['https://github.com/dsmorse']
9 |
10 | spec.summary = %q{jQuery plugin for draggable grid layouts}
11 | spec.description = %q{Gridster is a jQuery plugin that makes building intuitive draggable layouts from elements spanning multiple columns. You can even dynamically add and remove elements from the grid.}
12 | spec.homepage = "https://github.com/dsmorse/gridster.js"
13 | spec.licenses = ['MIT']
14 |
15 | spec.files = Dir["{demos,lib,vendor}/**/*"] + ["LICENSE", "bower.json", "package.json", "CHANGELOG.md", "README.md"]
16 |
17 | spec.require_paths = ["lib"]
18 |
19 | spec.add_development_dependency "bundler", "~> 1.9"
20 | spec.add_development_dependency "rake", "~> 10.0"
21 | end
22 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012 Ducksboard
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/demos/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Gridster Demos
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Samples
13 |
14 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "gridster",
3 | "title": "gridster.js",
4 | "description": "a drag-and-drop multi-column jQuery grid plugin",
5 | "version": "0.6.10",
6 | "homepage": "https://dsmorse.github.io/gridster.js/",
7 | "author": {
8 | "name": "ducksboard"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "git://github.com/dsmorse/gridster.js.git"
13 | },
14 | "bugs": {
15 | "url": "https://github.com/dsmorse/gridster.js/issues"
16 | },
17 | "license": "MIT",
18 | "licenses": [
19 | {
20 | "type": "MIT",
21 | "url": "https://github.com/dsmorse/gridster.js/blob/master/LICENSE"
22 | }
23 | ],
24 | "keywords": [],
25 | "devDependencies": {
26 | "bower": "~0.9.2",
27 | "grunt": "~0.4.5",
28 | "grunt-bump": "0.0.11",
29 | "grunt-contrib-clean": "^0.6.0",
30 | "grunt-contrib-concat": "^0.5.0",
31 | "grunt-contrib-copy": "^0.8.0",
32 | "grunt-contrib-cssmin": "~0.10.0",
33 | "grunt-contrib-jshint": "~0.10.0",
34 | "grunt-contrib-less": "^1.0.1",
35 | "grunt-contrib-qunit": "^0.7.0",
36 | "grunt-contrib-uglify": "~0.6.0",
37 | "grunt-contrib-watch": "~0.6.1",
38 | "grunt-contrib-yuidoc": "~0.7.0",
39 | "grunt-conventional-changelog": "~1.0.0",
40 | "grunt-gh-pages": "^0.10.0",
41 | "grunt-shell": "^1.1.2",
42 | "grunt-text-replace": "^0.4.0",
43 | "jshint-stylish": "^1.0.1"
44 | },
45 | "scripts": {
46 | "test": "grunt test"
47 | },
48 | "main": "dist/jquery.gridster.js",
49 | "directories": {
50 | "test": "test"
51 | },
52 | "jspm": {
53 | "main": "jquery.gridster",
54 | "directories": {
55 | "lib": "dist"
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/test/amd-main.js:
--------------------------------------------------------------------------------
1 | //Based on https://github.com/jonnyreeves/qunit-require
2 | /* global require, QUnit*/
3 | 'use strict';
4 | require.config({
5 | //set the baseUrl to the src dir so that gridster
6 | //AMD modules can be found.
7 | baseUrl: '../src/',
8 | paths: {
9 | 'QUnit': '../libs/qunit/qunit/qunit',
10 | 'jquery': '../libs/jquery/dist/jquery',
11 | 'gridster': 'jquery.gridster'
12 | },
13 | map: {
14 | // '*' means all modules will get 'jquery-private'
15 | // for their 'jquery' dependency.
16 | '*': { 'jquery': '../test/jquery-private' },
17 |
18 | // 'jquery-private' wants the real jQuery module
19 | // though. If this line was not here, there would
20 | // be an unresolvable cyclic dependency.
21 | '../test/jquery-private': { 'jquery': 'jquery' }
22 | },
23 | shim: {
24 | 'QUnit': {
25 | exports: 'QUnit',
26 | init: function() {
27 | QUnit.config.autoload = false;
28 | QUnit.config.autostart = false;
29 | }
30 | }
31 | }
32 | });
33 | /*
34 | Load all of our require'd files
35 |
36 | We have to load all of the gridster jquery.* modules so
37 | that they are defined for when gridster needs them.
38 |
39 | Lastly, load the testsuite which defines some tests.
40 | */
41 | require([
42 | 'QUnit',
43 | 'utils',
44 | 'jquery.coords',
45 | 'jquery.collision',
46 | 'jquery.draggable',
47 | '../test/testsuite'
48 | //Require'd files are passed as args, but we don't use them.
49 | ], function(QUnit/*, utils, coords, collision, draggable, testsuite*/) {
50 | QUnit.load();
51 | QUnit.start();
52 | }
53 | );
54 |
--------------------------------------------------------------------------------
/demos/adding-widgets-dynamically.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Demo » Add widgets dynamically » gridster.js
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Add widgets dynamically
15 |
16 | Create a grid adding widgets from an Array (not from HTML) using add_widget method. Widget position (col, row) not specified.
17 |
18 |
21 |
22 |
23 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/test/jquery.gridster.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | gridster.js Test Suite
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/demos/assets/less/demo.less:
--------------------------------------------------------------------------------
1 | /*! gridster.js - v0.6.10 - 2015-05-31
2 | * https://dsmorse.github.io/gridster.js/
3 | * Copyright (c) 2015 ducksboard; Licensed MIT */
4 |
5 | @bg-color: #26941f;
6 |
7 | body {
8 | background: @bg-color;
9 | font-size: 16px;
10 | font-family: 'Helvetica Neue', Arial, sans-serif;
11 | color: #ffffff;
12 | margin: 0;
13 | }
14 | h1, h2, h3, p {
15 | margin: 10px;
16 | }
17 | table {
18 | border-collapse: collapse;
19 | border-spacing: 0;
20 | }
21 | .demo {
22 | margin: 3em 0;
23 | padding: 7.5em 0 5.5em;
24 | background: @bg-color;
25 | }
26 | .demo:hover {
27 | .gridster {
28 | margin: 0 auto;
29 | opacity: .8;
30 | -webkit-transition: opacity .6s;
31 | -moz-transition: opacity .6s;
32 | -o-transition: opacity .6s;
33 | -ms-transition: opacity .6s;
34 | transition: opacity .6s;
35 | }
36 | }
37 | .content {
38 | color: white;
39 | }
40 | .gridster {
41 | .gs-w {
42 | background: #61A9CF;
43 | cursor: pointer;
44 | -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
45 | box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
46 | }
47 | .player {
48 | -webkit-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
49 | box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
50 | background: #BBB;
51 | }
52 | .gs-w.try {
53 | background-image: url(../img/sprite.png);
54 | background-repeat: no-repeat;
55 | background-position: 37px -169px;
56 | }
57 | .preview-holder {
58 | border: none !important;
59 | border-radius: 0 !important;
60 | background: red !important;
61 | }
62 | ul {
63 | background-color: #EFEFEF;
64 | }
65 | li {
66 | font-size: 1em;
67 | font-weight: bold;
68 | text-align: center;
69 | line-height: 100%;
70 | }
71 | }
72 | ul {
73 | list-style-type: none;
74 | }
75 | li {
76 | list-style: none;
77 | font-weight: bold;
78 | }
79 | .gridster-box {
80 | position: relative;
81 | width: 100%;
82 | height: 100%;
83 | }
84 | .controls {
85 | margin-bottom: 20px;
86 | }
87 |
--------------------------------------------------------------------------------
/demos/dynamic-grid-width.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Demo » Dynamic grid width » gridster.js
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | Dynamic grid width
14 |
15 | Drag or resize some widgets to the right side. Use max_cols option to set a maximum number of columns for the grid.
16 |
17 |
18 |
19 | 0
20 | 1
21 | 2
22 | 3
23 | 4
24 | 5
25 | 6
26 | 7
27 | 8
28 | 9
29 |
30 |
31 |
32 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/demos/grid-from-serialize.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Demo » Grid from serialize » gridster.js
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | Build grid from serialized positions
14 |
15 | Build a entire new grid from previously stored positions obtained with serialize method.
16 |
17 |
18 | Build from serialize
19 |
20 |
21 |
25 |
26 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/demos/jquery.gridster.demo2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | demo
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/test/jquery.gridster-amd.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | gridster.js AMD Test Suite
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/demos/sticky-postion.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Demo » sticky position widgets » gridster.js
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | Sticky position widgets
14 |
15 | Widgets can be moved to an exact postion on the grid and the grid will not attempt to collapse it down to a smaller size. Also widgets will not move out of the way automatically, but will move only on mouse up
16 |
17 |
18 |
19 |
20 |
21 | 0
22 | 1
23 | 2
24 | 3
25 | 4
26 | 5
27 | 6
28 | 7
29 | 8
30 | 9
31 |
32 |
33 |
34 |
35 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/demos/resize.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Demo » Resize » gridster.js
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | Resize
14 |
15 | Grab the right or bottom border and drag to the desired width or height.
16 |
17 |
18 | Resize random widget
19 |
20 |
21 |
22 |
23 | 0
24 | 1
25 | 2
26 | 3
27 | 4
28 | 5
29 | 6
30 | 7
31 | 8
32 | 9
33 |
34 |
35 |
36 |
41 |
42 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/demos/SwapDrop.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Gridster Grid Swapping Demo
6 |
7 |
8 |
9 |
10 |
11 |
12 |
22 |
23 |
24 |
31 |
32 |
Grid with larger widgets swapping spots with smaller ones
33 |
This demo represents using the branch in swap mode. This works best with shift_larger_widgets_down set to "false". However, smaller widgets do
34 | not displace larger ones.
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/demos/expandable-widgets.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Demo » Expandable widgets » gridster.js
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | Expandable widgets
14 |
15 | Expand widgets when hover on them using resize_widget method.
16 |
17 |
18 |
19 |
20 | 0
21 | 1
22 | 2
23 | 3
24 | 4
25 | 5
26 | 6
27 | 7
28 | 8
29 | 9
30 | 10
31 | 11
32 |
33 |
34 |
35 |
40 |
41 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](http://travis-ci.org/dsmorse/gridster.js)
2 | [](http://dsmorse.github.io/gridster.js/)
3 | [](http://gruntjs.com/)
4 | [](https://rubygems.org/gems/gridster.js-rails)
5 | [](http://bower.io/search/?q=gridster-js)
6 |
7 | Gridster.js
8 | ===========
9 |
10 | Gridster is a jQuery plugin that makes building intuitive draggable
11 | layouts from elements spanning multiple columns. You can even
12 | dynamically add and remove elements from the grid.
13 |
14 | More at [http://gridster.net/](http://gridster.net/).
15 |
16 | ### Live Preview at: [http://dsmorse.github.io/gridster.js/](http://dsmorse.github.io/gridster.js/)
17 |
18 | [Releases](https://github.com/dsmorse/gridster.js/releases)
19 |
20 | [CHANGELOG](https://github.com/dsmorse/gridster.js/blob/master/CHANGELOG.md)
21 |
22 | Gridster was created by Ducksboard but they have basiclly abondoned the project
23 | and even those who had write permissions to the repo are not merging pull requests.
24 |
25 | ## Forks
26 |
27 | As of result of the inactivity over the last year in the [Ducksboard](https://github.com/ducksboard/gridster.js) repository, [@dsmorse](https://github.com/dsmorse/gridster.js) has created a fork
28 | for current support. He will GLADLY accept pull requests, and will be working to merge existing
29 | Pull Requests from Ducksboard repo.
30 |
31 | ## Ruby on Rails integration
32 |
33 | This artifact is published to [rubygems.org](https://rubygems.org/gems/gridster.js-rails) to be consumed by ruby on rails applications.
34 |
35 | Include gridster.js-rails in Gemfile;
36 |
37 | ``` ruby
38 | gem 'gridster.js-rails'
39 | ```
40 |
41 | and run bundle install.
42 |
43 | ### Configuration
44 |
45 | Add this line to app/assets/stylesheets/application.css
46 |
47 | ``` css
48 | *= require jquery.gridster
49 | ```
50 |
51 | Add this line to app/assets/javascripts/application.js
52 |
53 | ``` javascript
54 | //= require jquery.gridster
55 | ```
56 |
57 | ## Contributing to this project
58 |
59 | Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.
60 |
61 | * [Bug reports](CONTRIBUTING.md#bugs)
62 | * [Feature requests](CONTRIBUTING.md#features)
63 | * [Pull requests](CONTRIBUTING.md#pull-requests)
64 |
65 |
66 | ## License
67 |
68 | Distributed under the MIT license.
69 |
70 | ## Whodunit
71 |
72 | Gridster is built by [Ducksboard](http://ducksboard.com/) with the help of all
73 | these [wonderful people](https://github.com/ducksboard/gridster.js/graphs/contributors).
74 |
--------------------------------------------------------------------------------
/dist/jquery.gridster.min.css:
--------------------------------------------------------------------------------
1 | /*! gridster.js - v0.6.10 - 2015-08-05 - * https://dsmorse.github.io/gridster.js/ - Copyright (c) 2015 ducksboard; Licensed MIT */
2 | .gridster{position:relative}.gridster>*{-webkit-transition:height .4s,width .4s;-moz-transition:height .4s,width .4s;-o-transition:height .4s,width .4s;-ms-transition:height .4s,width .4s;transition:height .4s,width .4s}.gridster .gs-w{z-index:2;position:absolute}.gridster .preview-holder{z-index:1;position:absolute;background-color:#fff;border-color:#fff;opacity:.3}.gridster .player-revert{z-index:10!important;-webkit-transition:left .3s,top .3s!important;-moz-transition:left .3s,top .3s!important;-o-transition:left .3s,top .3s!important;transition:left .3s,top .3s!important}.gridster.collapsed{height:auto!important}.gridster.collapsed .gs-w{position:static!important}.ready .gs-w:not(.preview-holder),.ready .resize-preview-holder{-webkit-transition:opacity .3s,left .3s,top .3s,width .3s,height .3s;-moz-transition:opacity .3s,left .3s,top .3s,width .3s,height .3s;-o-transition:opacity .3s,left .3s,top .3s,width .3s,height .3s;transition:opacity .3s,left .3s,top .3s,width .3s,height .3s}.gridster .dragging,.gridster .resizing{z-index:10!important;-webkit-transition:all 0s!important;-moz-transition:all 0s!important;-o-transition:all 0s!important;transition:all 0s!important}.gs-resize-handle{position:absolute;z-index:1}.gs-resize-handle-both{width:20px;height:20px;bottom:-8px;right:-8px;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pg08IS0tIEdlbmVyYXRvcjogQWRvYmUgRmlyZXdvcmtzIENTNiwgRXhwb3J0IFNWRyBFeHRlbnNpb24gYnkgQWFyb24gQmVhbGwgKGh0dHA6Ly9maXJld29ya3MuYWJlYWxsLmNvbSkgLiBWZXJzaW9uOiAwLjYuMSAgLS0+DTwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DTxzdmcgaWQ9IlVudGl0bGVkLVBhZ2UlMjAxIiB2aWV3Qm94PSIwIDAgNiA2IiBzdHlsZT0iYmFja2dyb3VuZC1jb2xvcjojZmZmZmZmMDAiIHZlcnNpb249IjEuMSINCXhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbDpzcGFjZT0icHJlc2VydmUiDQl4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjZweCIgaGVpZ2h0PSI2cHgiDT4NCTxnIG9wYWNpdHk9IjAuMzAyIj4NCQk8cGF0aCBkPSJNIDYgNiBMIDAgNiBMIDAgNC4yIEwgNCA0LjIgTCA0LjIgNC4yIEwgNC4yIDAgTCA2IDAgTCA2IDYgTCA2IDYgWiIgZmlsbD0iIzAwMDAwMCIvPg0JPC9nPg08L3N2Zz4=);background-position:top left;background-repeat:no-repeat;cursor:se-resize;z-index:20}.gs-resize-handle-x{top:0;bottom:13px;right:-5px;width:10px;cursor:e-resize}.gs-resize-handle-y{left:0;right:13px;bottom:-5px;height:10px;cursor:s-resize}.gs-w:hover .gs-resize-handle,.resizing .gs-resize-handle{opacity:1}.gs-resize-handle,.gs-w.dragging .gs-resize-handle{opacity:0}.gs-resize-disabled .gs-resize-handle,[data-max-sizex="1"] .gs-resize-handle-x,[data-max-sizey="1"] .gs-resize-handle-y,[data-max-sizey="1"][data-max-sizex="1"] .gs-resize-handle{display:none!important}
--------------------------------------------------------------------------------
/demos/using-drag-callbacks.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Demo » Using drag callbacks » gridster.js
5 |
6 |
7 |
8 |
9 |
10 |
19 |
20 |
21 |
22 |
23 | Drag callbacks
24 |
25 | Drag some widgets and see the log below.
26 |
27 |
28 |
29 | 0
30 | 1
31 | 2
32 | 3
33 | 4
34 | 5
35 | 6
36 | 7
37 | 8
38 | 9
39 |
40 |
41 |
42 | Log
43 |
44 |
45 |
46 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/src/utils.js:
--------------------------------------------------------------------------------
1 | (function (window, undefined) {
2 | 'use strict';
3 | /* Delay, debounce and throttle functions taken from underscore.js
4 | *
5 | * Copyright (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and
6 | * Investigative Reporters & Editors
7 | *
8 | * Permission is hereby granted, free of charge, to any person
9 | * obtaining a copy of this software and associated documentation
10 | * files (the "Software"), to deal in the Software without
11 | * restriction, including without limitation the rights to use,
12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | * copies of the Software, and to permit persons to whom the
14 | * Software is furnished to do so, subject to the following
15 | * conditions:
16 | *
17 | * The above copyright notice and this permission notice shall be
18 | * included in all copies or substantial portions of the Software.
19 | *
20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | * OTHER DEALINGS IN THE SOFTWARE.
28 | */
29 |
30 | window.delay = function (func, wait) {
31 | var args = Array.prototype.slice.call(arguments, 2);
32 | return setTimeout(function () {
33 | return func.apply(null, args);
34 | }, wait);
35 | };
36 |
37 | window.debounce = function (func, wait, immediate) {
38 | var timeout;
39 | return function () {
40 | var context = this, args = arguments;
41 | var later = function () {
42 | timeout = null;
43 | if (!immediate) {
44 | func.apply(context, args);
45 | }
46 | };
47 | if (immediate && !timeout) {
48 | func.apply(context, args);
49 | }
50 | clearTimeout(timeout);
51 | timeout = setTimeout(later, wait);
52 | };
53 | };
54 |
55 | window.throttle = function (func, wait) {
56 | var context, args, timeout, throttling, more, result;
57 | var whenDone = debounce(
58 | function () {
59 | more = throttling = false;
60 | }, wait);
61 | return function () {
62 | context = this;
63 | args = arguments;
64 | var later = function () {
65 | timeout = null;
66 | if (more) {
67 | func.apply(context, args);
68 | }
69 | whenDone();
70 | };
71 | if (!timeout) {
72 | timeout = setTimeout(later, wait);
73 | }
74 | if (throttling) {
75 | more = true;
76 | } else {
77 | result = func.apply(context, args);
78 | }
79 | whenDone();
80 | throttling = true;
81 | return result;
82 | };
83 | };
84 |
85 | })(window);
86 |
--------------------------------------------------------------------------------
/demos/using-resize-callbacks.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Demo » Using resize callbacks » gridster.js
5 |
6 |
7 |
8 |
9 |
10 |
19 |
20 |
21 |
22 |
23 | Resize callbacks
24 |
25 | Resize some widgets and see the log below.
26 |
27 |
28 |
29 |
30 | 0
31 | 1
32 | 2
33 | 3
34 | 4
35 | 5
36 | 6
37 | 7
38 | 8
39 | 9
40 |
41 |
42 |
43 | Log
44 |
45 |
46 |
47 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/demos/custom-drag-handle.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Demo » Custom drag handle » gridster.js
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Custom drag handle
15 |
16 | Restricts dragging from starting unless the mousedown occurs on the specified element(s).
17 |
18 |
19 |
20 |
21 |
22 |
23 | 0
24 |
25 |
26 |
27 | 1
28 |
29 |
30 |
31 | 2
32 |
33 |
34 |
35 | 3
36 |
37 |
38 |
39 |
40 | 4
41 |
42 |
43 |
44 | 5
45 |
46 |
47 |
48 | 6
49 |
50 |
51 |
52 | 7
53 |
54 |
55 |
56 | 8
57 |
58 |
59 |
60 |
61 | 9
62 |
63 |
64 |
65 |
66 |
79 |
80 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/demos/multiple-grids.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Demo » Multiple gridster intances » gridster.js
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | Multiple gridster instances with different configurations
14 |
15 | When using multiple gridster instances on the same page you can scope the CSS code generated by gridster using namespace config
16 | option.
17 |
18 | Demo 1
19 |
20 |
21 |
22 | 0
23 | 1
24 | 2
25 | 3
26 | 4
27 | 5
28 | 6
29 | 7
30 | 8
31 |
32 |
33 |
34 |
35 | Demo 2
36 |
37 |
38 |
39 | 0
40 | 1
41 | 2
42 | 3
43 | 4
44 | 5
45 | 6
46 | 7
47 | 8
48 |
49 |
50 |
51 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/demos/serialize.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Demo » Serialize » gridster.js
5 |
6 |
7 |
8 |
9 |
10 |
28 |
29 |
30 |
31 |
32 | Serialize positions
33 |
34 | Use serialize method to get widget positions. It returns a Array of objects that can be used as a JSON object.
35 |
36 |
37 | Serialize
38 |
39 |
40 |
41 |
42 |
43 |
44 | 0
45 | 1
46 | 2
47 | 3
48 |
49 | 4
50 | 5
51 | 6
52 | 7
53 | 8
54 |
55 | 9
56 |
57 | 10
58 | 11
59 | 12
60 | 13
61 |
62 | 14
63 | 15
64 |
65 | 16
66 |
67 |
68 |
69 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/demos/resize-limits.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Demo » Resize » gridster.js
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | Resize with limits
14 |
15 | Use resize.max_size and resize.min_size config options or data-max-sizex, data-max-sizey,
16 | data-min-sizex and data-min-sizey HTML attributes to limit widget dimensions when resizing.
17 |
18 | If a global max_size is specified through the config option, can be overwrited in specified widgets with HTML data-attributes or using set_widget_max_size
19 | method. This page has a global max limit of 4x4
20 |
21 |
22 |
23 |
24 |
25 | 0
26 |
27 | Overridden to 2, 6
28 |
29 |
30 | 1
31 |
32 | Overridden max-size to 6, 2
33 |
34 | 2
35 | 3
36 | 4
37 | 5
38 | 6
39 | 7
40 | 8
41 |
42 | 9
43 |
44 | Overridden min-size to 3, 3
45 |
46 | 10
47 | 11
48 | 12
49 | 13
50 | 14
51 | 15
52 | 16
53 |
54 |
55 |
56 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/demos/chaosWidget.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Demo » Resize » gridster.js
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Resize
15 |
16 | As hommage to Netflix's Chaos Monkey , this demo page is for testing. It attempts to insert a widget at a random location to ensure the overlap deconfliction locic works.
17 |
18 |
19 | Insert widget at random location
20 | Insert random sized widget at random location
21 |
22 |
23 |
24 |
25 | 0
26 | 1
27 | 2
28 | 3
29 | 4
30 | 5
31 | 6
32 | 7
33 | 8
34 | 9
35 |
36 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
59 |
60 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/demos/responsive.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Gridster Responsive Demo
5 |
6 |
7 |
8 |
9 |
10 |
11 |
27 |
28 |
29 |
30 |
Responsive Layout
31 |
This demo represents using the branch in responsive mode. This makes the grid as wide as the screen and responds to changes in browser
32 | width.
33 |
34 |
35 |
36 |
37 |
40 |
41 |
42 |
45 |
46 |
47 |
50 |
51 |
52 |
55 |
56 |
57 |
60 |
61 |
62 |
65 |
66 |
67 |
70 |
71 |
72 |
75 |
76 |
77 |
80 |
81 |
82 |
85 |
86 |
87 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |