0

在我的 html 中,我有 2 个<area>标签,其中包含映射两个国家的坐标。我使用的工具生成了 html 和 css。当我将鼠标悬停在一个区域上时,我希望它变得有点透明。但是,这并没有发生。这是我的代码:

<div class="cicka">
<area class="areas" shape="poly" coords="400,141,398,144,396,145,394,147,392,147,389,149,387,149,385,149,383,151,381,152,379,154,377,155,375,156,378,162,379,168,385,172,383,176,379,177,381,182,386,185,392,186,397,190,392,192,388,193,385,194,384,196,384,201,383,205,389,206,392,212,389,215,387,219,385,222,385,228,387,234,391,234,396,239,400,244,400,250,396,249,392,249,389,249,392,254,398,259,400,264,400,270,398,270,394,269,391,270,392,276,396,282,401,286,406,291,409,297,413,294,418,299,423,301,430,302,430,307,425,309,421,310,420,314,422,319,427,323,428,329,434,333,439,339,441,345,441,352,447,355,446,347,448,342,452,339,457,338,463,339,469,338,471,334,477,333,483,333,485,329,492,329,498,330,499,327,505,328,508,324,511,321,511,317,507,314,508,309,507,303,507,299,511,298,516,299,517,294,521,291,523,288,525,283,521,281,519,277,516,274,513,274,511,272,509,269,506,265,505,261,503,259,501,254,501,249,502,246,505,242,508,239,509,232,506,228,503,225,504,219,508,217,514,218,513,214,508,213,504,211,502,209,498,211,496,215,493,218,490,218,489,214,487,213,482,213,479,212,476,209,473,209,469,209,467,207,463,206,464,202,470,203,468,199,463,196,465,193,468,191,467,187,463,187,458,185,456,183,453,182,451,181,449,178,448,176,445,176,441,176,443,173,445,171,445,167,443,164,445,161,440,160,438,159,437,156,434,152,428,150,428,148,426,146,423,144,423,141,420,143,418,141,416,140,415,140,410,140,408,144,406,143,406,141,405,142," href="" alt="" title=""   />
</div>

和以下js:

<script>
        $(".cicka").hover(function() {
      $(this).stop().animate({opacity: "0.2"}, 'slow');
    },
    function() {
      $(this).stop().animate({opacity: "1"}, 'slow');
    });
    </script>

当我在普通 div 上调用此函数时,它会使其透明。但是,当我在包裹一个区域的 div 上调用它时,什么也没有发生。你能告诉我我做错了什么吗?

再次感谢

4

1 回答 1

-1

您可能想创建一个国家/地区的图像,为该图像分配一张地图,并在悬停一个区域后更改图像的不透明度。创建地图

<img src="country1.jpg" alt="country1" usemap="#map1">

<map name="map1" class="areas">
<area id="area1" shape="poly" coords="......" alt="Country 1">
</map>

然后是 jQuery

于 2012-10-21T14:20:30.167 回答