SunQuest
 
       JavaScript
  Home arrow JavaScript arrow Building `Drag-and-Drop` DIVs: Developing ...
IBM developerWorks
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 
IBM developerWorks
 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: Developing a Basic Script
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 30
    2005-12-07

    Table of Contents:
  • Building `Drag-and-Drop` DIVs: Developing a Basic Script
  • Setting up the basics: emulating drag-and-drop triggers
  • Dragging DIV elements: defining the “startDrag()” function
  • Moving DIVs around the web document: defining the “dragDiv()” function
  • Gluing the pieces together: defining the complete DIV dragging script

  • 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: Developing a Basic Script


    (Page 1 of 5 )

    Conventional pop-up windows in JavaScript applications may work for some things, but they can be annoying, and many people use pop-up blockers. There is an alternative: drag-and-drop DIV elements. In this article, Alejandro Gervasio gets you started with the basics.
    A downloadable file for this article is available here.

    With the progressive introduction of different methodologies for building web-based applications, the Web has become by far the largest development platform available today. Although the line drawn between client-side and server-side technologies delineates two broad categories within the large amount of tools for creating http-based applications, sometimes –- at least for the end user -- this line seems to vanish smoothly, due to the constant evolution in the development of user interfaces.

    As I mentioned before, creating sophisticated user interfaces that emulate those ones found in desktop applications is undeniably a hot topic for many web designers, and seems to be a growing trend aimed at impacting deeply the way that websites interact with users. Since I consider myself as a humble contributor on the topic of designing web interfaces, in this series I’ll attempt to add my two cents by providing a plain English description of how to build “drag-and-drop” DIVs, which can be used as a starting point for creating more sophisticated, desktop-like user interfaces.

    In the simplest sense, drag-and-drop DIV elements can be utilized as a good replacement for conventional pop-up windows, without having to deal with their intrinsic annoyances or with the possibility of being refused by pop-up blocking software. As you’ll see in short, the major drawbacks of “dragging” DIV boxes reside in their rather complex implementation in JavaScript, in addition to some conflictive accessibility issues. Considering that, if you’re thinking of including these sorts of elements on your website, you should first carefully evaluate their pros and cons, in order to avoid further hassles.

    Before I dive into writing any JavaScript code for setting up “dragging” DIVs, let me first explain the things that I plan to develop over this series. First, I’ll go through the makings of a simple script that will show you the underlying logic for setting up “drag-and-drop” elements. Second, I’ll develop a more robust application, by using the foundations of a third-party JavaScript library, and finally end up creating some “drag-and-drop” DIVs that will look and feel like conventional windows.

    Having established the goals of this tutorial series, it’s time to move on and find out how “drag-and-drop” DIVs can be created and included on web pages. Let’s go!

    More JavaScript Articles
    More By Alejandro Gervasio


       · This first tutorial goes through the implementation of a basic script for building...
       · This is a nice intro to developing draggable interfaces. There is a bug in the demo...
       · Thank you for the kind comments on my article. Yes, there's a small bug in the...
       · I can only say "Woooooowww..."Thank you Alejandro !Ecco
       · Thank you Ecco for your kind words on this tutorial. I feel extremely safisfied of...
       · Great script !!!I don't know if you still work on this but ...I need to make...
       · Thanks for commenting on this article, as well as for the kind words about the...
       · I have messed a bit obout with it and made some changes ... it now works perfectly,...
       · I'm glad to know you got it working. And of course, your feedback is truly...
       · One of the problems with this design occurs when you start adding content to the...
       · Thank you for commenting on my JavaScript article. Also, I’d like to thank you for...
       · First of all, thanks for a great tutorial. Nice structure and to the point!In an...
       · it was a very lucid style of explanation.... thanks a lot... this helped me very...
       · Thank you for the kind words on my JavaScript article, and of course I feel glad to...
       · This is a great article for something I was needing to do on in a short time frame....
       · Thank you for the kind comments on my article. Regarding your question, you can...
     

    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 3 hosted by Hostway