c# - How to save position of dragged items -


Hello, I want to save the status of the items that have been dropped in the database [ASPX, Javascript]. The user can leave the item in any number, change its shape and remove [hide] and after all, when it presses the 'Save' button, it should be saved in the database. I have the code to do this in the drop / stop but it will save all the dropped items that I only want to save in the final step. I think the developer should have done this very long, so please suggest some code. Live ('mousemove', function event) {$ ('# frame img'). Resizable (). Parents (). Draggable ();});}); $ (Function () {$ ('# frame img') live ('dblclick', function (event) {// $ (this). Revised ("deleted") $ (this) is not working. / $ (This) .convert (fixed) "; not working $ $ (this) .removeclass (); not working}};}); $ (document) .ready (function () {// counter Counter = 0; // Elementable $ ("IMG"). Dragable ({helper: 'clone', prevention: '# frames', // when first drag stop: function (AV, UI) {var pos = $ (Ui.helper). Offset (); Objnam = "#Clonniv" + Counter $ (objName). Css ({"left": pos.left, "top $ (ObjName) .removeClass (" drag "); // When an object with $ 1,000 (objName) is dragged. DrugGable ({prevention: 'parent' Stop: Function (AV, UI) {Var pos = $ (ui.helper) .offset ();}}}}}}} // Component Build $ droppable $ ("#frame"). Droppable ({drop: Function (ev, ui) {if (Ui.helper.attr ('id'). Search (/ drag [0-9] /)! = -1) {var pos = $ (ui.helper) .offset () ; Counter ++; var element = $ (ui.helper) .clone (); // var element = element1.resizable (); element.addClass ("tempclass"); $ (This) .append (element); $ (". Tempclass"). Ether ("id", "cloninva" + counter); // $ (". Tempclass"). Etter ("onclic", function () {$ (this) .remove ();); $ ("#ClonNiva" + Counter) .removeClass ("Tempus"); // Drag the item ID dynamically. Number = ui.helper.attr ('id'). Search (/ drag ([0- 9]) /) items dragged = "dragged" + regx. $ 1 //console.log (idemDragged) // Alert ('left' + pos.left + ', top' + pos.top + 'item' + item drags ged); $ ("#Cloninva" + Counter) .addClass (item drigged); }}}); // element resizable}};

Please correct me if anything is wrong. Thanks in advance

items , assuming your elements.

jQuery

  var location = []; $ ('# Item Li') Each (function (i) {location [i] = {x: $ (this) .offset (). Left, y: $ (this) .offset (). Top}}}) ;  

Then post it on your server side without knowing more details, I can not be 100% sure that all this is necessary.

On page load, just loop through locations and your li such as (assuming PHP)

html / php

  and LT; Ul id = "item" & gt; & Lt ;? Php foreach ($ item as $ item):? & Gt; & Lt; Li style = "left: & lt ;? php echo $ item ['x'] ;; & gt; px; top: & lt ;? php echo $ item ['x'];? & Gt; px" & gt; ; Item & lt; / Li & gt; & Lt ;? Php endforeach; ? & Gt; & Lt; / Ul & gt;  

Of course you

css

  #times {status: relative; } #Itam Lee {Status: Absolute; }  

Comments