• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 17. Dynamic HTML: Drag and Drop,... > Dragging and Dropping Visual Element...

Dragging and Dropping Visual Elements

To drag and drop visual elements, you can write the code yourself; it’s not difficult. Here’s an example targeted at IE4+ and NS6+. This example enables us to drag and drop an image. When the mouse goes down, we’ll start the dragging operation; in the mouse move event, we can move the image to correspond to the mouse location, and in the mouse up event, we can drop the image.

When the mouse goes down, I’ll record the location of the mouse in the image itself, and start the dragging operation by setting a variable named dragging to true:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint