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++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -