首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Imagemapster取消选择问题

Imagemapster取消选择问题
EN

Stack Overflow用户
提问于 2012-07-12 23:28:22
回答 1查看 1.6K关注 0票数 1

我已经阅读了我能找到的所有东西,也许我忽略了一些简单的东西。我有一张我的校园地图,一切都突出显示并正确选择。我遇到的唯一问题是:当点击时,每个建筑都会弹出一个信息气泡。在这些气泡上有一个'X‘关闭按钮。我正在尝试让建筑物在被单击时取消选择。(遗憾的是,我无法提供实时链接,目前仅限教职员工/学生访问)。

下面是地图的设置:

代码语言:javascript
复制
<img id="campus" style="top:420px; right:600px;" class=map src="localhost/display/images/map_off.jpg" usemap="#world" >

<map id="world" name="world" >                                                                                                                                

<area data-name="12" id="22" onclick="show_me(''12'')" shape="poly" coords="717,219,725" href="#/" alt="Building 1" />
<area data-name="22" id="22" onclick="show_me(''22'')" shape="poly" coords="693,459,699,459,693,472" href="#/" />
<area data-name="1" id="1" onclick="show_me(''1'')" shape="poly" coords="50,103,303,103,303,154,50,154,50,103" href="#/" alt="Building 2 /">
<area data-name="2" id="2" onclick="show_me(''2'')" shape="poly" coords="311,103,455,103,476,123,476,194,315,194" href="#/" alt="Building 3" />

以此类推。

设置:

代码语言:javascript
复制
$(document).ready(function() {
      map = $("#campus");
      map.mapster({
              fillOpacity: 1,
              singleSelect: true,
              render_highlight: {
                 altImage: "localhost/display/images/map_on.jpg"
              },
              render_select: {
                 altImage: "localhost/display/images/map_on.jpg"
              }
      });    
});

和我的close函数:

close函数:

代码语言:javascript
复制
function closeWindow() {
          var selected_area = map.mapster(''get'');
          alert(selected_area); //this shows the correct map_key

          var select_status = map.mapster("get",map_key);
          alert(select_status); //but this shows 'false'

          $("#display_bubble").css("display","none");

        }

有什么想法吗?我感觉我忽略了一些小东西,但我就是找不到。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-08-11 08:37:50

以防其他人发生这种情况,我在options:下设置了'mapKey‘,而不是:

代码语言:javascript
复制
$(document).ready(function() {
  map = $("#campus");
  map.mapster({
          fillOpacity: 1,
          ...
  });
 options:({   
   mapKey: "data-name",
   ...

});

它需要是:

代码语言:javascript
复制
$(document).ready(function() {
  map = $("#campus");
  map.mapster({
          mapKey: "data-name",
          fillOpacity: 1,
          ...
  }); 
  options:({
          ...

});

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11455253

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档