Adding borders to image on click or mouse hover

822 Views Asked by At

I want to add round borders to selected image areas on a map, how do I do it?

4

There are 4 best solutions below

2
On

You may use jQuery:

$('body').on('click', 'img', function() {
    $(this).addClass('with-round-corners');
});
1
On

You can use CSS

img{
    border:none;
}
img:hover{
    border:1px solid;
}
0
On
img
{
border:0px;
}
img:hover
{
border:1px solid black;
border-radius:5px;
}
1
On

Use the below JQuery code on click :

$(imageAreasSelector).css({ 'border': '1px solid Red' });
$(imageAreasSelector).css({ 'border-radius': '5px' });