2 Replies - 660 Views - Last Post: 02 August 2011 - 09:07 PM

#1 itdoell  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 239
  • Joined: 13-January 11

How to detect if a file is being dragged?

Posted 02 August 2011 - 06:47 PM

I want to make it so that when a file is being dragged I activate a filedrop, that would otherwise be inactive. Yet I do not know how to detect when a file is being dragged (much like how gmail changes when you are dragging a file). Can anyone point me in the right direction as to how this can be accomplished?
Is This A Good Question/Topic? 0
  • +

Replies To: How to detect if a file is being dragged?

#2 hiddenghost  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 39
  • View blog
  • Posts: 621
  • Joined: 15-December 09

Re: How to detect if a file is being dragged?

Posted 02 August 2011 - 08:50 PM

Here's a link to something about drap and drop I found through Google. Not sure how much you know.
http://luke.breuer.c...p-tutorial.aspx

The line in the code from the above page that says //this is how we know we're not dragging
function onmouseup(e) { 
         if (_dragElement != null) { 
               _dragElement.style.zIndex = _oldZIndex; 

                // we're done with these events until the next  
               onmousedown document.onmousemove = null; 

               document.onselectstart = null; 

               _dragElement.ondragstart = null; 

              // this is how we know we're not dragging 
              _dragElement = null; _debug.innerHTML = 'mouse up'; 
        } 
}


The reverse of null could be made for your dragon droppings.
Was This Post Helpful? 1
  • +
  • -

#3 hiddenghost  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 39
  • View blog
  • Posts: 621
  • Joined: 15-December 09

Re: How to detect if a file is being dragged?

Posted 02 August 2011 - 09:07 PM

You could also record the coordinate position and feed it back to a function that contains what you want to happen to the page with.
Using javascript css:
Pseudo code
function is_drag(drag){drag = is_mouse_dragging} //check for mouse drag
function drag(){mouse_dragging;                  //do mouse drag
         mouse = mouse_dragging;
         is_it = is_drag(mouse);    //check for mouse drag by argument to is_drag
}



Something like that. :basecase:
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1