最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - What language is used for this feature? - Stack Overflow

programmeradmin1浏览0评论

I came by this website, while surfing: /?lang=en_US and on the frontpage it has a map of iraq, in which you can hover, and it will highlight the parts. clicking it would, link it to the page of a part.

I was thinking, what did he use for this feature? is it javascript/jquery, or something like that?

I came by this website, while surfing: http://kurdon./?lang=en_US and on the frontpage it has a map of iraq, in which you can hover, and it will highlight the parts. clicking it would, link it to the page of a part.

I was thinking, what did he use for this feature? is it javascript/jquery, or something like that?

Share Improve this question edited Dec 23, 2011 at 18:59 Rob W 349k87 gold badges807 silver badges682 bronze badges asked Dec 23, 2011 at 18:55 messimessi 433 bronze badges 2
  • 1 Looks like some scripting. No sign of a Flash or Silverlight plugin – Bas Slagter Commented Dec 23, 2011 at 18:58
  • 1 +1 That's a very well written page, thanks for posting it. – rfmodulator Commented Dec 23, 2011 at 19:02
Add a ment  | 

5 Answers 5

Reset to default 9

They uses just javascript for the map.

At the right side of the map there are links which contains this:

onmouseover="change_map(1);"

And the function defined inline on the page:

function change_map(region) {
    var MapItem = document.getElementById("imageRegions");
    var ListItem = document.getElementById("region_" + region);
    MapItem.style.backgroundImage = 'url(/images/region_' + region + '.gif)';
    MapItem.style.backgroundPosition = '0px 0px';
    MapItem.style.backgroundRepeat = 'no-repeat';
    ListItem.style.color = "#D0630A";
    return true;
}

The areas of the map itself are realized by image maps.

It's an HTML image map, bined with javascript effects attached to the onmouseover and onmouseout events.

The image map defines the area via coordinates, and the javacript changes the color and applies the other effects.

Try viewing the source of the page in Chrome Web Developer tools or firebug to see more.

You could do this with HTML image maps, although I'm not sure if they have been deprecated.

See: http://en.wikipedia/wiki/Image_map#Definition_in_HTML

It's just javascript manipulating the CSS.

just looks like JavaScript to me using a map and setting the right coords for the different regions and then changing the color when someone does mouseover / mouseout

发布评论

评论列表(0)

  1. 暂无评论