JQuery drag-and-drop change element on startup

Can I drag an item using the start method? For example, if I have a button called a yellow square that you can drag. It just says the yellow square, but when you drag it, you are actually dragging the yellow square, not the button with the property being dragged.

I assume I am asking if it is possible to change the element that is being dragged?

Thanks!

+4
source share
1 answer

Yes it is. Take a look at the api-document: http://jqueryui.com/draggable/#visual-feedback

For example, the “client assistant” should be what you are looking for.

This is the corresponding code:

$( "#draggable" ).draggable({ cursor: "move", helper: function( event ) { return $( "<div class='ui-widget-header'>I'm a custom helper</div>" ); } }); 
+3
source

Source: https://habr.com/ru/post/1482040/


All Articles