user2248911
user2248911

Reputation: 21

HTML5 Drag and Drop - prevent drop for one item

I am looking at this HTML5 demo of a bin that 'eats' anything in the list . I want to modify it to 'eat' only some of the items and others would be rejected.

The code is here: http://html5demos.com/drag

This code works in IE which is a requirement. Any tips would be appreciated.

Upvotes: 1

Views: 186

Answers (1)

user2248911
user2248911

Reputation: 21

Being impatient I found a way to do this..

<ul> <li><a draggable="true" id="one" href="#">one</a></li> <li><a draggable="true" href="#" id="three">two</a></li> <a draggable="true" href="#" id="trick">trick</a> <li><a draggable="true" href="#" id="four">four</a></li> <a draggable="true" href="#" id="five">five</a> </ul>

The solution was to realise that I could add an extra tag within the list. I then had to style the tag to look exactly the same as the list item. If the person tries to drag the trick item it doesn't disappear from the list and the bin doesn't provide a text response.

Upvotes: 1

Related Questions