html - Make Cursor position in center for ui.helper in jquery-ui draggable method -


i want cursor in center ui.helper of draggable .

i doing this

$(".soclass").draggable({            cursor: "move",           helper: 'clone',           revert: "invalid",           tolerance: "fit",           start: function(event, ui){               $(this).draggable("option", "cursorat", {             left: math.floor(ui.helper.width() / 2),             top: math.floor(ui.helper.height() / 2)           });              }        }); 

using i cursor in center after first drop. how can center align cursor right first drop.

jsfiddle

you can access offset.click property of draggable instance, pretty setting cursor @ option problem setting option, describe it'll applied next time trigger start event. using property can set on current event. this:

start: function(event, ui){     $(this).draggable('instance').offset.click = {     left: math.floor(ui.helper.width() / 2),     top: math.floor(ui.helper.height() / 2) };  

https://jsfiddle.net/38fay00b/


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -