NikAkd
NikAkd

Reputation: 33

jQuery UI: Set class for draggable when valid

I know i can set the class for a dropable object when a valid dragable is hovering, using hoverClass. Is it posible to do that, but for the draggable object (just when it is hovering over a valid target)?

Upvotes: 0

Views: 26

Answers (1)

NikAkd
NikAkd

Reputation: 33

ok, i managed to do it using events in the dropable:

el.dropable({
   accept: ".target",
   over: function(e, ui){
       ui.draggable.addClass("valid");
   },
   out: function(e, ui){
       ui.draggable.removeClass("valid");
   },
   hoverClass: "valid"
});

Upvotes: 1

Related Questions