Highlight the specific area of the image using .maphilight()

1.1k Views Asked by At

I want to highlight the specific area of the image tag on keyPress Event. While using .maphilight() method from the maphilight jQuery plugin, it is working only on mouseover on the area.

I am using chart image and which contain the no.of series points with area tag.

when click the navigation key focus is move to one point to another point and focused point will need to highlight.

How to use .maphilight() method to highlight the specific area of image on "KeyPress"

I would appreciate your code and suggestions.

Thanks,

Bharathi.

1

There are 1 best solutions below

3
On

The following code should work for you:

$(document).keydown(function(event) {
    $('#idOfAreaToHighlight').mouseover();
});

This will trigger when any key is pressed. If you need to limit it to a specific key you can add an if statement to check event.keyCode.