Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Javascript handle drag and drop

Reply
Thread Tools

Javascript handle drag and drop

 
 
Kai Zhu
Guest
Posts: n/a
 
      10-28-2006
I wrote a piece of code to handle drag and drop of DIV element.
The code works fine in firefox, but has some problem will IE. We I load the
HTML, I can not drag the DIV, and IE seems to be not responding to anything.
But when I minimize the IE window, and maximize it again, the code works
fine.
Can anybody give me some case that can cause this situation?


 
Reply With Quote
 
 
 
 
smerf
Guest
Posts: n/a
 
      10-28-2006
"Kai Zhu" <(E-Mail Removed)> wrote in message
news:ehvvm1$p6q$(E-Mail Removed)...
>I wrote a piece of code to handle drag and drop of DIV element.
> The code works fine in firefox, but has some problem will IE. We I load
> the HTML, I can not drag the DIV, and IE seems to be not responding to
> anything. But when I minimize the IE window, and maximize it again, the
> code works fine.
> Can anybody give me some case that can cause this situation?


What version of IE?

--
Smerf
"Why don't pet food companies make mouse flavored cat food?"


 
Reply With Quote
 
 
 
 
James Black
Guest
Posts: n/a
 
      10-28-2006

Kai Zhu wrote:
> I wrote a piece of code to handle drag and drop of DIV element.
> The code works fine in firefox, but has some problem will IE. We I load the
> HTML, I can not drag the DIV, and IE seems to be not responding to anything.
> But when I minimize the IE window, and maximize it again, the code works
> fine.
> Can anybody give me some case that can cause this situation?


You may want to show what your code looks like, for the DnD.

Also, if you can't figure out how to get it to work, you can look at
various libraries that will do DnD.

I am curious if when the user clicks on the div, if you then set the
mousemove event handler so that you can track where the mouse is at.

You should also set the mouseup at that point on the div, so that when
they release the mouse you can unset these two events, and stop the
dragging.

Here is a simple tutorial that may help you out:
http://www.webreference.com/programm...mn2/index.html

 
Reply With Quote
 
cwdjrxyz
Guest
Posts: n/a
 
      10-28-2006

Kai Zhu wrote:
> I wrote a piece of code to handle drag and drop of DIV element.
> The code works fine in firefox, but has some problem will IE. We I load the
> HTML, I can not drag the DIV, and IE seems to be not responding to anything.
> But when I minimize the IE window, and maximize it again, the code works
> fine.
> Can anybody give me some case that can cause this situation?


See the source code of http://www.cwdjr.net/test/newDrag.html . This
works on all browser that I have, including IE6, and it will drag
divisions, images, or text. The script is based on one posted in this
group 2 or 3 years ago by Lasse Nielsen as noted in a comment in the
source code. This question often comes up here. There are a lot of drag
codes out there that work only on a few browsers.

 
Reply With Quote
 
TheBagbournes
Guest
Posts: n/a
 
      10-29-2006
Kai Zhu wrote:
> I wrote a piece of code to handle drag and drop of DIV element.


You're wasting your time.

Use http://developer.yahoo.com/yui/
 
Reply With Quote
 
cwdjrxyz
Guest
Posts: n/a
 
      10-29-2006

TheBagbournes wrote:
> Kai Zhu wrote:
> > I wrote a piece of code to handle drag and drop of DIV element.

>
> You're wasting your time.
>
> Use http://developer.yahoo.com/yui/


Thus site may work. However I can not recommend it. For example, in
their simple example of code to drag 3 objects, a very simple case,
they managed to generate over 200 lines of code on the main page with
links to 6 external scripts, and there were several validation errors
at the W3C validator. They seem to have generated a bloated
one-size-fits-all code, that reminds me of some of the Windows programs
for writing code. Also, for the several external scripts, you are
linking to an outside server rather than to your own if you are not
using Yahoo as a host. Of course you likely could download this whole
bloated mess of Yahoo scripts, but you will then have to put them all
up on your server and link to several external scripts every time you
wish to use even the most simple drag-and-drop operation.

 
Reply With Quote
 
Kai Zhu
Guest
Posts: n/a
 
      10-29-2006
Thank you for recommending this nice code to me, this helps a lot.
"cwdjrxyz" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
>
> Kai Zhu wrote:
>> I wrote a piece of code to handle drag and drop of DIV element.
>> The code works fine in firefox, but has some problem will IE. We I load
>> the
>> HTML, I can not drag the DIV, and IE seems to be not responding to
>> anything.
>> But when I minimize the IE window, and maximize it again, the code works
>> fine.
>> Can anybody give me some case that can cause this situation?

>
> See the source code of http://www.cwdjr.net/test/newDrag.html . This
> works on all browser that I have, including IE6, and it will drag
> divisions, images, or text. The script is based on one posted in this
> group 2 or 3 years ago by Lasse Nielsen as noted in a comment in the
> source code. This question often comes up here. There are a lot of drag
> codes out there that work only on a few browsers.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outstandingly excellent javascript drag-and-drop tutorial withworking code pete Javascript 29 07-01-2010 11:26 AM
JavaScript Web Application with Drag and Drop - Easy to do? David Smithz Javascript 1 02-28-2006 11:28 AM
Drag & Drop Sortable Lists with JavaScript and CSS in a IFRAME arjenmeijer@nietbereikbaar.nl Javascript 2 11-29-2005 01:02 PM
drag and drop javascript asp/php variable exchange rnhuisman@gmail.com Java 1 05-04-2005 06:29 PM
Drag & Drop API: get source component in drop traget 'dragOver' Oliver Klein Java 0 08-24-2003 12:01 PM



Advertisments