Try this:
$('.initiator').on('mouseenter mouseleave', function(e) {
$('.receiver').trigger(e.type);
})
It will apply the same triggers for the receiver as the initiator receives for both mouseenter and mouseleave. Note that:
.hover(over, out)
is just a high-level variant of:
.on('mouseenter', over).on('mouseleave', out)
so using that information you can be more precise when binding and triggering mouse events.
As noted in the comment, you can also use:
$('.initiator').hover(function(e) {
$('.receiver').trigger(e.type);
})
There are lots more to read here: http://api.jquery.com/hover/
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…