spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / dhtml / column9
Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source
Logo

The DHTML Lab Jigsaw Puzzle, Part II: IE4 cont'd
grabbing the puzzle pieces


Drag & Drop

We have discussed drag and drop concepts extensively in columns 6 and 7. Complete drag and drop code for Explorer 4 was developed in column 7. Here we will discuss only the modifications necessary for the puzzle.

As you will recall, the drag and drop code for Explorer took this form:

Grabbing the Puzzle or Puzzle Piece

We will modify the grabEl() function in two places. We gave all draggable elements in the puzzle a draggable property. This applies to the puzzle itself and all puzzle pieces that are created. The value of this property is true or false, depending on whether the element should be dragged or not. In the case of the full puzzle, the value is toggled by the drag toggle button in the controls. Puzzle pieces cannot be dragged if they are placed in their correct position in the puzzle. We will be discussing routines to determine this further down. Since we are concerned with a true value for the draggable property, we modify grabEl() to search it through the element heirarchy that exists under the mousedown:

We also make a change in the code that places the dragged element on top of other draggable elements. When the full puzzle is dragged, no puzzle pieces are visible, as it can only be dragged in a solved form. Therefore, the full puzzle element is excluded from the z-index incrementation.

The user can now continue to attempt a solve by moving the piece.


Produced by Peter Belesis and

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Working with the DOM Stylesheets Collection · Administering RBAC in PHP 5 CMS Framework · xref: Automatic Cross Referencing Script
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Combine BottomCount() with Other MDX Functions to Add Sophistication · Creating a Daemon with Python · The Coming Voice-over-WiMAX Revolution

All Rights Reserved. Legal Notices.
Created: Nov. 13, 1997
Revised: Jan. 18, 1998

URL: http://www.webreference.com/dhtml/column9/puzzGrab.html