Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- driftPositions : function() {
- if (!drift)
- return;
- drift = false;
- for (var i = 0; i< this.collection.length; i++) {// loop through tasks
- var taskDiv = $("#"+ this.collection.at(i).id);//get task DOM object
- if (!taskDiv.data('draggable')) {//if taskDiv is not being dragged
- var slotDiv = $("#slot_" + i);
- var taskPos = taskDiv.position();//get Pos
- var slotPos = slotDiv.position();//get Pos
- var newX = this.closerCoord(taskPos.left, slotPos.left);//gets an x pos closer to the destination
- var newY = this.closerCoord(taskPos.top, slotPos.top);//gets a y pos closer to the destination
- if (newY != taskPos.top || newX != taskPos.left) {//if pos is changed
- taskDiv.css({left:newX, top:newY});//Set new position
- drift = true;
- }
- }
- }
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement