Reputation: 4491
I have jQuery UI draggable
working on an element.
When elementA
is being dragged, I'm removing a class from elementB
.
I want the detect when elementA
has stopped being dragged, and add the class back to elementB
.
$('.container').draggable({
// Output offset while dragging box
drag: function(){
$('.properties').removeClass('appear');
// Detect mouseup after dragging has stopped
// and add .appear back to .properties
}
});
Upvotes: 1
Views: 211
Reputation: 1706
Use stop
:
$('.container').draggable({
// Output offset while dragging box
drag: function(){
$('.properties').removeClass('appear');
// Detect mouseup after dragging has stopped
// and add .appear back to .properties
},
stop: function() {
// Add your class back to elementB here.
$('.properties').addClass('appear');
}
});
Read more about stop
and Draggable events in the jQuery UI examples: http://jqueryui.com/draggable/#events
Upvotes: 1