Generate a single index.html file containing a drag-and-drop interface for reordering a…
- User
Generate a single index.html file containing a drag-and-drop interface for reordering a list or grid of items.
The file should:
Contain a list or grid of several simple items (e.g., colored boxes, list entries with text). Include at least 5 sample items directly in the HTML. Utilize a JavaScript library for drag-and-drop functionality via a CDN link (e.g., SortableJS, or another suitable library). Implement the logic so users can click and drag an item to change its position relative to other items in the list/grid. Include necessary CSS styling (either via tag or by using the optional Tailwind CSS CDN link if the model prefers) to make the items visually distinct and the drag operation clear (e.g., changing cursor, adding a temporary class while dragging). The component must be functional even without Tailwind. All HTML structure, the JavaScript code to initialize the drag-and-drop library and handle events, and either embedded custom CSS or the use of optional Tailwind classes should be within this single index.html file. The focus is on the interactive reordering functionality using a JS library, with styling being a secondary concern that can use either method.
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.