Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery treat hover on two elements as one element

Tags:

jquery

I have an image map which I have overlaid with some markers in the form of anchors. I currently have a hover trigger on each image map area and the associated anchor - as shown in screen shot enter image description here

I need to treat these two elements as one, as currently when the mouse is moved out of one into the other, it calls .hover() and the callback again. I want to call the hover callback only when the mouse is moved out of either elements.

like image 259
davewilly Avatar asked Nov 13 '22 14:11

davewilly


1 Answers

$('#areaID1, #areaID2').hover(function(){
    //same mouseover event
}, function(){
    //same mouseout event
});
like image 69
Adam Merrifield Avatar answered Jan 07 '23 22:01

Adam Merrifield