Thursday, July 2, 2009

[jQuery] How to use jQuery with ImageMap

I. Aim: First click on imagemap area - select area(highlight). Second
click- deselect area.

II. Very similar example. The result should be like this:
a) HTML code: <p class="blue">Click to toggle</p>
b) CSS: .blue { color:blue; }
.highlight { background:yellow; background-color: #1a3654;}
c) JS:
$(document).ready(function(){
$("p").click(function () {
$(this).toggleClass("highlight");
});
});

III. I'd found jQuery plugin "Map Hilight". It works great onOver,
hovewer like I said - I need possibility to select/deselect area easily
(onClick).

IV. So how can I do this?

P.S.: developers, thanks for great jQuery features!

No comments: