Unable to set element offset positions
Hello,
I am using the jQuery UI Draggable widget. Inside the 'create' event, i am setting the offsetTop and offsetLeft properties to some custom value, but these values are not being set and the element's position remains the same. Can someone suggest any way to do the same.
I am posting my code:
- $(".myStyle").draggable({
- grid: [198, 118],
- containment: "#containment-wrapper",
- cursor: "move",
- refreshPositions: true,
- create: elementCreated
- });
-
-
- function elementCreated(event, ui) {
- debugger;
- var divID = event.target.id;
-
- var mydiv = $("#" + divID);
-
- var top = $(mydiv).data('top');
- var left = $(mydiv).data('left');
-
- mydiv.offsetTop = top;
- mydiv.offsetLeft = left;
- }