How to listen to drag
event when a jquery-ui-sortable
is being dragged?
By hit-n-trial strategy, I've tried drag
event from jquery-ui-draggable
but it's not working.
$('.widget_container').sortable({
drag: function(event, ui) { console.log('drag'); }
});
By default its value is "input,textarea,button,select,option". This option is a selector that identifies another sortable element that can accept items from this sortable. This allows items from one list to be moved to other lists, a frequent and useful user interaction. If omitted, no other element is connected.
Using jQuery UI, we can make the DOM(Document Object Model) elements to drag anywhere within the view port. This can be done by clicking on the draggable object by mouse and dragging it anywhere within the view port. If the value of this option is set to false, it will prevent the DOM elements to be dragged .
jQueryUI provides draggable() method to make any DOM element draggable. Once the element is draggable, you can move that element by clicking on it with the mouse and dragging it anywhere within the viewport.
You have one of these problems: Your jQuery or jQuery UI Javascript path files are wrong. Your jQuery UI does not include draggable. Your jQuery or jQuery UI Javascript files are corrupted.
Use sort
event for this purpose:
$(".sortable").sortable({
sort: function(e) {
console.log('X:' + e.screenX, 'Y:' + e.screenY);
}
});
http://jsbin.com/kegeb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With