Hi,
I'm trying to loop through an array "fSel.sI", and based on the data inside, pass them as values (not reference) on to a number of function declarations. Right now the problem is that mydrag contains a reference, and as draggable gets called it uses the last array item data. Hence when start: drag: stop: is called, the values are not unique. Help?
makeDraggable : function() {
// create new draggable
for (var i = 0; i < fSel.sI.length; i++) {
mydrag = fSel.sI[i];
$("#" + mydrag).draggable({
cancel: [''],
distance: 5,
containment: "#fWorkspace",
handle: mydrag,
start: function() { dragRegister(mydrag)},
drag: function() { dragItems(mydrag)},
stop: function() { dragStop(mydrag)}
});
}
},