javascript - If an item was not dragged to a specific location, then have it go to back to original position? -


i made quick drag , drop type menu. made drag item list trash div, , give alert saying "gone"

i want make can't drag item anywhere. has go trash or ".list4" it's called, or else send it's original position.

here jsfiddle: http://jsfiddle.net/gdze8/

here javascript:

$( init )  function init() { $(".contentitem").draggable(); $(".list4").droppable( {     drop: handledropevent }); }  function handledropevent ( event, ui ) {     var draggable = ui.draggable;     alert("gone") } 

also, while i'm here, there way delete item once goes in "trash"?

try this

$(".contentitem").draggable({ revert: 'invalid' }); 

js fiddle demo


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -