Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 79f509c

Browse files
committed
add handle_class option
1 parent 91e9d6f commit 79f509c

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ $(function () {
132132
- `cell_height` - one cell height (default: `60`)
133133
- `draggable` - allows to override jQuery UI draggable options. (default: `{handle: '.grid-stack-item-content', scroll: true, appendTo: 'body'}`)
134134
- `handle` - draggable handle selector (default: `'.grid-stack-item-content'`)
135+
- `handle_class` - draggable handle class (e.g. `'grid-stack-item-content'`). If set `handle` is ignored (default: `null`)
135136
- `height` - maximum rows amount. Default is `0` which means no maximum rows
136137
- `float` - enable floating widgets (default: `false`) See [example](http://troolee.github.io/gridstack.js/demo/float.html)
137138
- `item_class` - widget class (default: `'grid-stack-item'`)

dist/gridstack.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@
383383
var GridStack = function(el, opts) {
384384
var self = this, one_column_mode;
385385

386+
opts = opts || {};
387+
386388
this.container = $(el);
387389

388390
opts.item_class = opts.item_class || 'grid-stack-item';
@@ -394,6 +396,7 @@
394396
item_class: 'grid-stack-item',
395397
placeholder_class: 'grid-stack-placeholder',
396398
handle: '.grid-stack-item-content',
399+
handle_class: null,
397400
cell_height: 60,
398401
vertical_margin: 20,
399402
auto: true,
@@ -408,7 +411,7 @@
408411
handles: 'se'
409412
}),
410413
draggable: _.defaults(opts.draggable || {}, {
411-
handle: '.grid-stack-item-content',
414+
handle: opts.handle_class || (opts.handle ? '.' + opts.handle : '') || '.grid-stack-item-content',
412415
scroll: false,
413416
appendTo: 'body'
414417
})

dist/gridstack.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)