Not sure what you are looking for, but maybe it could be like this:
var elements = $("#a1, #a2");
$("#a3").on('mouseleave', nextElm);
function nextElm() {
$('div').on('mouseenter', thisIsIt);
$("#r").html('Now hover another element ?');
}
function thisIsIt(e) {
if ($.inArray(e.target, elements)!=-1){
$("#r").html('yes');
}else{
$("#r").html('no');
}
$("#a3").off('mouseleave', nextElm);
$('div').off('mouseenter', thisIsIt);
}
Fiddle
source
share