views:

220

answers:

2

Ok. So I'm going to go out on a limb and presume that a draggables "start" event gets fired again after the movement has stopped and user starts moving again, even if hasn't been dropped yet?

The main issue is I want my draggable to create my droppables depending on having an odd or even class.

But I'm afraid the user may start dragging, stop, start dragging again without releasing the mouse button which could rebind the droppables. Is there a way to only catch the drag start event once?

+1  A: 

Your assumption is false. The dragstart event will only fire once. Exactly when the user first starts the dragging. It doesn't matter if he stops the dragging motion for a few seconds and then restarts moving the mouse. As long as he doesn't drop the draggable and then click a draggable the event won't fire again.

The event which gets fired while the user drags the draggable around is the drag event. This fires when the mouse is moved while dragging.

jitter
A: 

then that means i can create my droppables based on the item being dragged, however when i try this on the start event, it doesn't seem to work?

$("#theSchedule, #theExtras").live('mouseover', function () {
 $(".curSelected").draggable({
   helper: 'clone',
   opacity: 0.50,
   appendTo: 'body',
   zIndex: 4,
   addClasses: false,
   start: createDrops,
   stop: tooltip
  });
 }).live('mouseout', function (e) {
  $(".curSelected").draggable('destroy');
 });

function createDrops(ev, ui){
    disableTip();
        if($(ui.helper).hasClass("even")){
     $(".even, .evenExtra").droppable({
  accept: ".curSelected",
  addClasses: false,
  hoverClass: 'dropHover',
  drop: moveJob
     });
    } else {
     $(".odd, .oddExtra").droppable({
  accept: ".curSelected",
  addClasses: false,
  hoverClass: 'dropHover',
  drop: moveJob
     });
    }

}
mlebrun15
This is another, different question mlebrun.
jvenema
good point i'll move it.
mlebrun15
link to new question?
Jeff Martin
http://stackoverflow.com/questions/1827385/how-to-create-dynamic-droppables-jquery-php-ajax
mlebrun15