dupdup
dupdup

Reputation: 772

jquery how to color area dynamically

I have image map like this

<map name="imgmap">
<area shape="poly" coords="63,10,64,38,89,37,91,10" href="#" id="x1"></map>

and how can I color that area dynamically with jquery like

("#x1").color('red')

?

Upvotes: 1

Views: 7048

Answers (3)

Akhilesh Kumar
Akhilesh Kumar

Reputation: 919

use this code .... hopw it will help you...

<script>
 $(function() 
 {
      $('.map').maphilight({
      fillColor: '008800'
 });
 var data = $('#id').data('maphilight') || {};

 data.alwaysOn = !data.alwaysOn;
 $('#id').data('maphilight', data).trigger('alwaysOn.maphilight');
 });

Upvotes: 0

Amit
Amit

Reputation: 716

you can try using the maphilight plugin of jquery. it does what you want to achieve - http://davidlynch.org/blog/2008/03/maphilight-image-map-mouseover-highlighting/

Upvotes: 2

SilentGhost
SilentGhost

Reputation: 319561

Originally I thought that this might work:

$("#x1").css("background-color", 'red')

However, upon further investigation it become quite clear that there is no easy way to do what you want.
Perhaps, your aim could be achieved by absolute positioning of the special images under your main image and poping them up on $("#x1").hover().

Upvotes: 1

Related Questions