Here my Jquery:
$(".list").draggable({helper: 'clone', cursor: 'hand'});
$(".drop1").droppable({
accept: '.list',
hoverClass: 'dropareahover',
drop: function(ev, ui){
var targetId = $(this).attr("id");
var allTargets = $("#" + targetId, ".tble");
$("#" + targetId).each(function() {
//here i have to write the conditions.
});
}
});
i need to 开发者_如何学Cplace the content into particular area. if i place the content other area. it will not accept.
Could this be what you are looking for? (the revert option for jquery draggable)
$(".list" ).draggable({ helper: 'clone', cursor: 'hand', revert: 'invalid'});
From: http://jqueryui.com/demos/draggable/
If revert set to true, the element will return to its start position when dragging stops. Possible string values: 'valid', 'invalid'. If set to invalid, revert will only occur if the draggable has not been dropped on a droppable. For valid, it's the other way around.
Code examples
Initialize a draggable with the revert option specified.
$(".selector" ).draggable({ revert: true });
精彩评论