santa
santa

Reputation: 12512

alternative to mouseover w/ jQuery

I need to change css of an element while a cursor either:

  1. Hovers over, or
  2. Drags another element over.

Both .hover() and .mouseover() seem to work fine on toll over, but neither one works for drag over. Is there anything else that would work?

Once the mouse moves away from the element it needs to go back to the previous state.

Thanks.

Upvotes: 0

Views: 1701

Answers (2)

Jesse
Jesse

Reputation: 10466

just bind both events to the same handler, like so:

var hoverHandler = function(e){
    /// do stuff
}
$('#myelement').mouseover(hoverHandler).bind('dragover', hoverHandler);

Upvotes: 2

SLaks
SLaks

Reputation: 887453

Use the dragover event.

Upvotes: 2

Related Questions