Unable to set element offset positions

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:
  1. $(".myStyle").draggable({
  2.             grid: [198, 118],
  3.             containment: "#containment-wrapper",
  4.             cursor: "move",
  5.             refreshPositions: true,
  6.             create: elementCreated
  7.         });


  8. function elementCreated(event, ui) {
  9.         debugger;
  10.         var divID = event.target.id;

  11.         var mydiv = $("#" + divID);

  12.         var top = $(mydiv).data('top');
  13.         var left = $(mydiv).data('left');

  14.         mydiv.offsetTop = top;
  15.         mydiv.offsetLeft = left;
  16.     }