SunQuest
 
       JavaScript
  Home arrow JavaScript arrow Building `Drag-and-Drop` DIVs: An Advanced...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Building `Drag-and-Drop` DIVs: An Advanced Approach
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 8
    2005-12-14

    Table of Contents:
  • Building `Drag-and-Drop` DIVs: An Advanced Approach
  • Creating cross-browser “dragging” DIVs: coding a simple script
  • Getting the dragging script completed: adding some CSS rules and (X)HTML markup
  • Going one step further: setting up multiple dragging DIVs

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Building `Drag-and-Drop` DIVs: An Advanced Approach


    (Page 1 of 4 )

    This is it, the article you were waiting for! Welcome to the second tutorial of the series “Building drag-and-drop DIVs.” In three parts, this series teaches you how to create realistic dragging DIVs, in order to boost the capabilities of web-based user interfaces, by introducing the “drag-and-drop” features found in many popular desktop applications.

    In the previous article, I went through the development of a simple script, which allowed us to build dragging DIV elements, by utilizing a couple of easy-to-grasp functions that combined the appropriate sequence of event handlers, in order to emulate a real “drag-and-drop” mouse effect. Keeping this idea in mind, I first drew in plain English the general guidelines for handling the “mousedown”, “mouseup” and “mousemove” events within the scope of the document object, and then translated the underlying “dragging” theory into concrete JavaScript code.

    However, when working with large client-side applications, the script I wrote previously may be a little inflexible and hard-to-maintain, for including in routines that implement the behavior of user interfaces (at least those ones that use JavaScript for constructing behavior layers). From a programmer’s point of view, it’s best to have a highly customizable and modular library, which can be used as the workhorse for creating cross-browser dragging DIV elements, without being concerned too much about how DHTML is handled behind the scenes.

    In accordance with the above discussed concepts, over this second article of the series, I’ll take a reusable approach to building “drag-and-drop” DIVs, and utilize the functionality provided by Michael Foster’s JavaScript X library. In my opinion it is one of the best cross-browser DHTML library available on the Web. It will not only allow you to create dragging DIVs, but do a lot more astonishing DTHML things, in a true cross-browser fashion.

    Having outlined the general guidelines for this tutorial, it’s time to leap forward and begin creating cross-browser, dragging DIVs. Let’s get started.

    More JavaScript Articles
    More By Alejandro Gervasio


       · This second article explains how to build drag-and-drop DIVS, by utilizing the...
     

    JAVASCRIPT ARTICLES

    - Detect Browser Compatibility with the Reques...
    - Using the EXT JS Date Picker Widget
    - Ajax Hack for Entering Information Without R...
    - EXT JS 2.1 Overview
    - Using the Style Object for Zebra Tables with...
    - Binary Searching
    - An Improved Approach to Building Zebra Tables
    - Assigning Background Colors Dynamically to Z...
    - Building Zebra Tables with CSS and JavaScript
    - JavaScript: Array Objects
    - A Closer Look at Smart Markers with Yahoo! M...
    - Using Polylines and Smart Markers with Yahoo...
    - Bulleted Menu of Links
    - Creating Click Loggers and Basic Markers wit...
    - Adding Pan Controls to Yahoo! Maps







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway