Reputation: 119
I need to stop the mouseover event if a condition is true and I don't really now how. I 've made this:
$('body').mouseover(function() {
if ($('span.done').length > 0) {
alert('done!');
}
});
after the alert() is called, the mouseover should stop, and stop calling the allert. Any help is much appreciated. Thanks.
Upvotes: 0
Views: 433
Reputation: 140230
$('body').on("mouseover.done",function() {
if ($('span.done').length > 0) {
$("body").off("mouseover.done");
alert('done!');
}
});
Upvotes: 1