mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Allow for an optional drag handle to be specified
When defining the gridster, you can now define a draggable.handle selector: For example: $("#widgets").gridster({ widget_margins: [10, 10], widget_base_dimensions: [565, 400], draggable: { stop: function(event, ui) { console.log('save new columns'); }, handle: '.title' } }); If handle is omitted (or left blank), it works as it did previously. If a value is specified, then dragging only starts if the element which was clicked matches the selector specified. Added by @vieron: Closes #29
This commit is contained in:
committed by
vieron
parent
07b34131bd
commit
552df22e1c
@ -14,7 +14,8 @@
|
||||
limit: true,
|
||||
offset_left: 0,
|
||||
autoscroll: true,
|
||||
ignore_dragging: ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON']
|
||||
ignore_dragging: ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON'],
|
||||
handle: null
|
||||
// ,drag: function(e){},
|
||||
// start : function(e, ui){},
|
||||
// stop : function(e){}
|
||||
@ -329,6 +330,10 @@
|
||||
};
|
||||
|
||||
fn.ignore_drag = function(event) {
|
||||
if (this.options.handle) {
|
||||
return !$(event.target).is(this.options.handle);
|
||||
}
|
||||
|
||||
return $.inArray(event.target.nodeName, this.options.ignore_dragging) >= 0;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user