The next few recipes will focus on an overall larger project of a drag-and-drop shopping cart interface. In this recipe, we focus on the basics of Drag.Move()
, which handles the advanced nature of the drag-and-drop process.
The markup for the cart images uses a descending element hierarchy of DIV->A->IMG
. We could likely do without the A tag; however, graceful degradation of the shopping cart interface would require this element. When creating the backup interface that would be used when JavaScript is not available, link this product image to a page where the item could be added to the cart without the need for client-side scripting.
For those with JavaScript, we will have quite a fancy method of adding products to the cart through the use of the Drag
class object derivative Drag.Move()
, using the mandatory element argument, which can either be a string ID from an element or a MooTools enhanced reference to an element.
<...